Selia UI Documentation
repository·master·Indexed 18 days ago
https://github.com/nauvalazhar/seliaAn opinionated React UI library built on Tailwind CSS and Base UI, designed for rapid development or as a foundation for custom design systems. Selia provides a set of customizable components—including Accordion, Alert, Alert Dialog, Autocomplete, Avatar, and Badge—and includes a CLI for adding components to projects. It is optimized for Inter and JetBrains Mono font families and utilizes a class-merging utility for robust styling.
What's inside Selia
- Selia is an opinionated UI library for React built on top of Tailwind CSS and Base UI. It is designed to be used as-is for rapid development or as a foundation for building a custom design system. The library prioritizes structured and cohesive interfaces while remaining highly customizable.
Introduction to Selia
masterSelia is an opinionated UI library for React built on top of Tailwind CSS and Base UI. It is designed to be used either as a ready-to-use component library or as a foundation for building a custom design system.
Key characteristics include:
- Opinionated Defaults: Components come with intentional spacing, colors, and visual balance to reduce the need for manual utility class overrides.
- Contextual Styling: Instead of per-usage overrides, Selia uses contextual styling to handle common component combinations automatically.
- Customizable: While opinionated by default, it is designed to be highly adjustable to fit specific design needs.
Features included in Selia for Laravel
masterThe Selia Laravel integration provides a comprehensive set of features out of the box:
- Identity & Access: Authentication, Roles and permissions, User list management, Role list management, Permission list management.
- User Management: Password reset, Email verification, Update profile, Delete profile.
- UI/UX: Dark mode support, Multiple language support (via
mcamara/laravel-localizationandi18next). - Database: SQLite by default, but configurable to MySQL or PostgreSQL.
How Selia components achieve visual cohesion
masterSelia components are designed to work together out of the box using two primary mechanisms: Plain Variants and Contextual Styling.
- Plain Variants: Many components provide a
variant="plain"prop. This strips away default visual styling like backgrounds, borders, and shadows, making the component suitable for nesting inside other components without visual conflicts. - Contextual Styling: Parent components use
data-slotattributes to apply specific styles to their children. This allows a parent (like aCardorCommand) to automatically adjust the appearance of nested components (like aTableContainerorInputGroup) to ensure a cohesive layout.
- Plain Variants: Many components provide a
Structure an Alert Dialog
masterThe
AlertDialogfollows a specific composition pattern. It requires anAlertDialogTriggerto open the dialog and anAlertDialogPopupto contain the content. The content is organized intoHeader(containing aTitle),Body(containing aDescription), andFooter(containing aCloseaction).<AlertDialog> <AlertDialogTrigger> Trigger </AlertDialogTrigger> <AlertDialogPopup> <AlertDialogHeader> <AlertDialogTitle> Title </AlertDialogTitle> </AlertDialogHeader> <AlertDialogBody> <AlertDialogDescription> Description </AlertDialogDescription> </AlertDialogBody> <AlertDialogFooter> <AlertDialogClose> Close </AlertDialogClose> </AlertDialogFooter> </AlertDialogPopup> </AlertDialog>How the Menu component structure works
masterThe Menu component follows a composition pattern where a
Menuroot wraps aMenuTrigger(the button that opens the menu) and aMenuPopup(the container for the actual options). Inside theMenuPopup, you can organize items usingMenuGroup,MenuSeparator, or create hierarchies usingMenuSubmenu.<Menu> <MenuTrigger>Menu</MenuTrigger> <MenuPopup> <MenuGroup> <MenuGroupLabel>Account</MenuGroupLabel> <MenuItem> <UserIcon /> Profile </MenuItem> </MenuGroup> <MenuSeparator /> <MenuSubmenu> <MenuSubmenuTrigger>Theme</MenuSubmenuTrigger> <MenuPopup> <MenuItem>Light</MenuItem> <MenuItem>Dark</MenuItem> </MenuPopup> </MenuSubmenu> </MenuPopup> </Menu>Compose a Dialog structure
masterA Dialog is composed of a root
Dialogcomponent containing aDialogTrigger(to open the modal) and aDialogPopup(the modal content container). The popup typically follows a structured layout of Header, Body, and Footer.<Dialog> <DialogTrigger>Open Dialog</DialogTrigger> <DialogPopup> <DialogHeader> <DialogTitle>Dialog Title</DialogTitle> </DialogHeader> <DialogBody> <DialogDescription>Dialog Description</DialogDescription> </DialogBody> <DialogFooter> <DialogClose>Close</DialogClose> </DialogFooter> </DialogPopup> </Dialog>Group items in a Combobox
masterYou can organize items into logical sections within the Combobox usingComboboxGroup,ComboboxGroupLabel, andComboboxCollectioncomponents.Use the Meter component for static numeric values
masterThe
Metercomponent provides visual indicators for showing numeric values within a specific range.When to use Meter vs. Progress:
- Use
Meterwhen displaying static numeric values in a range (e.g., storage capacity, battery level). - Use
Progresswhen showing the progress of an active task in a horizontal bar.
- Use
Configure Drawer direction and swipe behavior
masterUse the
directionprop onDrawerPopupto specify which edge the drawer slides in from. The default isright.Important: To ensure swipe-to-dismiss works correctly, the
swipeDirectionprop on theDrawercomponent must match thedirectionprop on theDrawerPopup.// Example: Left-side drawer <Drawer swipeDirection="left"> <DrawerPopup direction="left">...</DrawerPopup> </Drawer> // Other valid directions: "right", "top", "bottom"Compose a Menubar structure
masterThe
Menubarcomponent follows a hierarchical structure consisting ofMenuitems, triggers, popups, and submenus.<Menubar>: The root container.<Menu>: A top-level menu item.<MenuTrigger>: The element that opens the menu.<MenuPopup>: The container for menu items, supporting asizeprop (e.g.,sm).<MenuItem>: An individual clickable action.<MenuSubmenu>: A container for nested menu items.<MenuSubmenuTrigger>: The trigger for a submenu, which accepts arenderprop to define its appearance (often using a<MenuItem>).<MenuSubmenuPopup>: The popup container for submenu items.<MenuSeparator />: A visual divider between items.
<Menubar> <Menu> <MenuTrigger>File</MenuTrigger> <MenuPopup size="sm"> <MenuItem>New File</MenuItem> <MenuItem>Open</MenuItem> <MenuItem>Save</MenuItem> <MenuSubmenu> <MenuSubmenuTrigger render={<MenuItem>Export</MenuItem>} /> <MenuSubmenuPopup size="sm"> <MenuItem>PNG</MenuItem> <MenuItem>JPG</MenuItem> <MenuItem>PDF</MenuItem> </MenuSubmenuPopup> </MenuSubmenu> <MenuSeparator /> <MenuItem>Exit App</MenuItem> </MenuPopup> </Menu> </Menubar>How Selia's 'Own the Code' model works
masterUnlike traditional UI libraries that are consumed as closed, opaque packages, Selia is designed for code ownership.
When you use a Selia component, the source code is intended to become part of your own codebase. This allows you to:
- Read and Understand: No hidden abstraction layers.
- Modify and Refactor: Change the component logic or styles directly to suit your application.
- Remove: Delete components that are no longer needed without managing complex dependency trees.
This approach aims to prevent dependency lock-in and provides full control over your UI evolution.