@sqlrooms/ui
A comprehensive UI component library for SQLRooms applications, built on top of React and Tailwind CSS. This package provides a collection of reusable, accessible, and customizable components designed to create consistent and beautiful user interfaces.
This library is based on shadcn/ui, a collection of beautifully designed, accessible components that can be copied and pasted into your apps.
Features
- 🎨 Modern Design: Clean, modern components following design best practices
- ♿ Accessibility: Components built with accessibility in mind
- 🌗 Theming: Support for light and dark modes
- 📱 Responsive: Mobile-friendly components that adapt to different screen sizes
- 🧩 Composable: Components designed to work together seamlessly
- 🔄 React Hooks: Useful hooks for common UI patterns
Installation
npm install @sqlrooms/ui
# or
yarn add @sqlrooms/uiBasic Usage
Using Components
import {Button, Card, Input} from '@sqlrooms/ui';
function LoginForm() {
return (
<Card className="mx-auto max-w-md p-6">
<h2 className="mb-4 text-2xl font-bold">Login</h2>
<form>
<div className="space-y-4">
<div>
<Input type="email" placeholder="Email" required />
</div>
<div>
<Input type="password" placeholder="Password" required />
</div>
<Button type="submit" className="w-full">
Sign In
</Button>
</div>
</form>
</Card>
);
}Using Hooks
import {toast, useDisclosure} from '@sqlrooms/ui';
function MyComponent() {
const {isOpen, onOpen, onClose} = useDisclosure();
const handleAction = () => {
// Perform some action
toast.success('Success!', {
description: 'Your action was completed successfully.',
});
onClose();
};
return (
<div>
<Button onClick={onOpen}>Open Dialog</Button>
<Dialog open={isOpen} onOpenChange={onClose}>
<DialogContent>
<DialogHeader>
<DialogTitle>Confirm Action</DialogTitle>
<DialogDescription>
Are you sure you want to perform this action?
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="outline" onClick={onClose}>
Cancel
</Button>
<Button onClick={handleAction}>Confirm</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
);
}Available Components
- Layout: Card, Resizable, SettingsPanelHeader, Tabs
- Forms: Button, Checkbox, Combobox, Input, Select, Slider, Switch, Textarea
- Feedback: Alert, Progress, Spinner, Toast
- Navigation: Accordion, Breadcrumb, Dropdown Menu, TabStrip
- Overlay: Dialog, ModifierScrollOverlay, Popover, Tooltip
- Data Display: Badge, Table
- Utility: Error Boundary, Theme Switch
Combobox
Use the compound Combobox component for searchable select dropdowns built on the package's Popover and Command primitives.
import {Combobox} from '@sqlrooms/ui';
function MySelector() {
const [value, setValue] = useState('');
const options = [
{value: 'option1', label: 'Option 1'},
{value: 'option2', label: 'Option 2'},
{value: 'option3', label: 'Option 3'},
];
const selectedLabel =
options.find((option) => option.value === value)?.label ?? 'Select option';
return (
<Combobox value={value} onChange={setValue}>
<Combobox.Trigger>
<span>{selectedLabel}</span>
</Combobox.Trigger>
<Combobox.Content
searchable
searchPlaceholder="Search..."
emptyMessage="No results found."
>
{options.map((option) => (
<Combobox.Item key={option.value} value={option.value}>
<span>{option.label}</span>
</Combobox.Item>
))}
</Combobox.Content>
</Combobox>
);
}Available compound components:
Combobox(root) - Manages state and provides contextCombobox.Trigger- Button to open the dropdownCombobox.Content- Popover content wrapperCombobox.Item- Individual selectable item
Pass disabled to the root Combobox to disable opening the dropdown and selecting items.
For advanced composition, the lower-level useCombobox hook is also exported.
Settings Panel Header
Use SettingsPanelHeader for compact settings surfaces that should share the standard settings icon and optional close affordance.
import {Button, SettingsPanelHeader} from '@sqlrooms/ui';
import {CodeIcon} from 'lucide-react';
function SettingsPanel({onClose}: {onClose: () => void}) {
return (
<div className="flex h-full flex-col gap-2 p-2">
<SettingsPanelHeader
actions={
<Button type="button" variant="ghost" size="icon">
<CodeIcon className="h-3.5 w-3.5" />
</Button>
}
onClose={onClose}
/>
{/* settings controls */}
</div>
);
}Advanced Features
- Component Composition: Build complex UIs by composing simple components
- Form Handling: Integrated with React Hook Form for easy form management
- Custom Styling: Extend components with custom styles using Tailwind CSS
- Animation: Smooth transitions and animations for interactive elements
TabStrip
TabStrip supports a fontSize prop for sizing tab labels, inline rename inputs, search dropdown content, and built-in subcomponents consistently:
<TabStrip
tabs={tabs}
openTabs={openTabs}
selectedTabId={selectedTabId}
fontSize="12px"
/>Use renderSearchItemLabel when the search dropdown should show custom row content, such as a status spinner next to a tab name.
For more information, visit the SQLRooms documentation.
Classes
Interfaces
- BadgeProps
- ButtonProps
- ComboboxTriggerProps
- ComboboxContentProps
- ComboboxItemProps
- CopyButtonProps
- TabDescriptor
- TabStripProps
- Dimensions
- UseAspectRatioDimensionsProps
- UseComboboxOptions
- UseComboboxReturn
- UseDisclosureReturnValue
Type Aliases
- CalendarProps
- ComboboxRootProps
- ModifierScrollOverlayProps
- ResizablePanelOrientation
- RunButtonProps
- SettingsPanelHeaderProps
- TabStripDndMode
- TabStripDragData
- TreeNodeData
- FontSizeToken
- Theme
- ResolvedTheme
Variables
- Accordion
- AccordionItem
- AccordionTrigger
- AccordionContent
- Alert
- AlertTitle
- AlertDescription
- AspectRatio
- badgeVariants
- Breadcrumb
- BreadcrumbList
- BreadcrumbItem
- BreadcrumbLink
- BreadcrumbPage
- buttonVariants
- Button
- Card
- CardHeader
- CardTitle
- CardDescription
- CardContent
- CardFooter
- Checkbox
- Combobox
- Command
- CommandInput
- CommandList
- CommandEmpty
- CommandGroup
- CommandSeparator
- CommandItem
- ContextMenu
- ContextMenuTrigger
- ContextMenuGroup
- ContextMenuPortal
- ContextMenuSub
- ContextMenuRadioGroup
- ContextMenuSubTrigger
- ContextMenuSubContent
- ContextMenuContent
- ContextMenuItem
- ContextMenuCheckboxItem
- ContextMenuRadioItem
- ContextMenuLabel
- ContextMenuSeparator
- CopyButton
- Dialog
- DialogTrigger
- DialogPortal
- DialogClose
- DialogOverlay
- DialogContent
- DialogTitle
- DialogDescription
- DropdownMenu
- DropdownMenuTrigger
- DropdownMenuGroup
- DropdownMenuPortal
- DropdownMenuSub
- DropdownMenuRadioGroup
- DropdownMenuSubTrigger
- DropdownMenuSubContent
- DropdownMenuContent
- DropdownMenuItem
- DropdownMenuCheckboxItem
- DropdownMenuRadioItem
- DropdownMenuLabel
- DropdownMenuSeparator
- EditableText
- ErrorPane
- Form
- FormItem
- FormLabel
- FormControl
- FormDescription
- FormMessage
- Input
- Label
- Menubar
- MenubarTrigger
- MenubarSubTrigger
- MenubarSubContent
- MenubarContent
- MenubarItem
- MenubarCheckboxItem
- MenubarRadioItem
- MenubarLabel
- MenubarSeparator
- ModifierScrollOverlay
- PaginationContent
- PaginationItem
- Popover
- PopoverTrigger
- PopoverAnchor
- PopoverContent
- ProgressModal
- Progress
- RadioGroup
- RadioGroupItem
- ResizablePanel
- RunButton
- ScrollArea
- ScrollBar
- Select
- SelectGroup
- SelectValue
- SelectTrigger
- SelectScrollUpButton
- SelectScrollDownButton
- SelectContent
- SelectLabel
- SelectItem
- SelectSeparator
- Separator
- SettingsPanelHeader
- Sheet
- SheetTrigger
- SheetClose
- SheetPortal
- SheetOverlay
- SheetContent
- SheetTitle
- SheetDescription
- SidebarMenuButton
- SkeletonPane
- Slider
- SpinnerPane
- Spinner
- Switch
- TabStrip
- Table
- TableHeader
- TableBody
- TableFooter
- TableRow
- TableHead
- TableCell
- TableCaption
- Tabs
- TabsList
- TabsTrigger
- TabsContent
- Textarea
- ThemeSwitch
- ToggleGroup
- ToggleGroupItem
- toggleVariants
- Toggle
- TooltipProvider
- Tooltip
- TooltipTrigger
- TooltipContent
- DEFAULT_THEME
- DEFAULT_THEME_STORAGE_KEY
Functions
- Badge
- BreadcrumbSeparator
- BreadcrumbEllipsis
- Calendar
- CommandDialog
- CommandShortcut
- ContextMenuShortcut
- DialogHeader
- DialogFooter
- Drawer
- DrawerTrigger
- DrawerPortal
- DrawerClose
- DrawerHandle
- DrawerOverlay
- DrawerContent
- DrawerHeader
- DrawerFooter
- DrawerTitle
- DrawerDescription
- DropdownMenuShortcut
- FormField
- useFormField
- HoverCard
- HoverCardTrigger
- HoverCardContent
- MenubarMenu
- MenubarGroup
- MenubarPortal
- MenubarRadioGroup
- MenubarSub
- MenubarShortcut
- Pagination
- PaginationLink
- PaginationPrevious
- PaginationNext
- PaginationEllipsis
- ResizablePanelGroup
- ResizableHandle
- ScrollableRow
- SheetHeader
- SheetFooter
- useSidebar
- SidebarProvider
- Sidebar
- SidebarTrigger
- SidebarRail
- SidebarInset
- SidebarInput
- SidebarHeader
- SidebarFooter
- SidebarSeparator
- SidebarContent
- SidebarGroup
- SidebarGroupLabel
- SidebarGroupAction
- SidebarGroupContent
- SidebarMenu
- SidebarMenuItem
- SidebarMenuAction
- SidebarMenuBadge
- SidebarMenuSkeleton
- SidebarMenuSub
- SidebarMenuSubItem
- SidebarMenuSubButton
- Skeleton
- Toaster
- Tree
- useIsMobile
- useAspectRatioDimensions
- useCombobox
- useDebounce
- useDebouncedCallback
- useDebouncedValue
- useDisclosure
- useRelativeCoordinates
- resolveFontSizeClass
- cn
- getThemePreference
- getResolvedTheme
- getTheme
- ThemeProvider
- useTheme