2.2 KiB
2.2 KiB
NiceGUI Extensions (niceguiex) - Project Overview
Project Structure
This project is a collection of extensions for NiceGUI, organized as a modular package that can be extended with new components and utilities.
Current Structure
src/
niceguiex/
__init__.py
async_elements/
__init__.py
base.py # AsyncElement base class
elements.py # Pre-built async element types
chat_input.py # ChatInput component (to be moved into package)
Key Components
1. Async Elements (niceguiex.async_elements)
Provides async-aware UI elements that can perform async operations during initialization while maintaining full typing support.
Base Class: AsyncElement[T] - Generic base for creating async elements
Pre-built Elements:
- AsyncColumn, AsyncRow, AsyncCard
- AsyncDialog, AsyncTabs, AsyncScrollArea
- AsyncExpansion, AsyncCarousel, AsyncMenu
- And more...
2. ChatInput Component
A textarea component optimized for chat interfaces:
- Enter to send message
- Shift+Enter for new line
- Callback-based message handling
- Currently in
chat_input.py, should be moved to package structure
Import Convention
The package uses a submodule structure to organize different types of extensions:
from niceguiex.async_elements import AsyncColumn, AsyncCard
from chat_input import ChatInput # To be: from niceguiex.inputs import ChatInput
Technical Notes
- Async Module Name: Originally planned as
niceguiex.asyncbut changed toasync_elementsbecauseasyncis a Python reserved keyword - Type Safety: All components maintain full type hints for IDE support
- Inheritance Pattern: Components can be used via generic
AsyncElement[T]or by inheriting from specific types
Future Extensions
The package structure is designed to accommodate:
- Input components (ChatInput, forms, etc.)
- Layout helpers
- Data visualization components
- Utility functions
- Theme and styling extensions
Development Guidelines
When adding new components:
- Consider which submodule they belong in
- Maintain full typing support
- Provide both generic and inheritance-based usage patterns where applicable
- Include proper async/await support where needed