# Prototyper UI — Full Documentation > Composable React component library built on Base UI primitives. Tailwind CSS v4, OKLCH design tokens, shadcn-compatible. > Tech stack: React 19, Next.js 15, Tailwind CSS v4, Base UI, TypeScript. > Install components via: pnpm dlx shadcn@latest add https://prototyper-ui.com/r/{component}.json # Button > A button with gradient variants built on Base UI URL: https://prototyper-ui.com/docs/components/button Base UI reference: https://base-ui.com/react/components/button ```tsx import { Button } from "@/components/ui/button" export default function ButtonDemo() { return } ``` ## Installation ```bash pnpm dlx shadcn@latest add https://prototyper-ui.com/r/button.json ``` This will add the following files to your project: - `components/ui/button.tsx` ## Usage ```tsx import { Button } from "@/components/ui/button" ``` ## Examples ### Destructive ```tsx import { Button } from "@/components/ui/button" export default function ButtonDestructive() { return } ``` ### Outline ```tsx import { Button } from "@/components/ui/button" export default function ButtonOutline() { return } ``` ### Secondary ```tsx import { Button } from "@/components/ui/button" export default function ButtonSecondary() { return } ``` ### Ghost ```tsx import { Button } from "@/components/ui/button" export default function ButtonGhost() { return } ``` ### Link ```tsx import { buttonVariants } from "@/components/ui/button" export default function ButtonLink() { return Link } ``` ### Icon ```tsx import { ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonIcon() { return ( ) } ``` ### With Icon ```tsx import { Mail } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonWithIcon() { return ( ) } ``` ### Loading ```tsx import { Loader2 } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonLoading() { return ( ) } ``` ### Press ```tsx import { Button } from "@/components/ui/button" export default function ButtonPress() { return } ``` ## Styling ### Data Slots Use `data-slot` attributes to target the button in CSS: | Slot name | Element | | --------- | ------------------- | | `button` | The ` ``` ## API Reference ### Button A clickable button element with gradient variants. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `variant` | `"default" \| "destructive" \| "outline" \| "secondary" \| "ghost" \| "link"` | `"default"` | Visual style variant | | `size` | `"default" \| "xs" \| "sm" \| "lg" \| "icon" \| "icon-xs" \| "icon-sm" \| "icon-lg"` | `"default"` | Size of the button | | `isPending` | `boolean` | - | Shows pending state and sets aria-disabled | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Button content | All [Base UI Button props](https://base-ui.com/react/components/button) are forwarded via `...props`. ### buttonVariants A `cva` helper exported for use outside of the ` ) } ``` ## Styling ### Data Slots Use `data-slot` attributes to target specific parts of the combobox: | Slot name | Element | | ---------------------- | ------------------------------------------ | | `input-group-control` | The text input element | | `combobox-trigger` | Dropdown trigger button | | `combobox-clear` | Clear selection button | | `combobox-content` | Positioned popup panel | | `combobox-list` | Scrollable list container | | `combobox-item` | Individual option | | `combobox-empty` | Empty state message | | `combobox-group` | Group container | | `combobox-group-label` | Group label | | `combobox-separator` | Separator line between groups | | `combobox-chips` | Chips container for multi-select | | `combobox-chip` | Individual chip | | `combobox-chip-remove` | Chip remove button | | `combobox-chips-input` | Input within chips container | | `combobox-value` | Selected value display | | `combobox-icon` | Icon element | | `combobox-status` | Screen-reader status (visually hidden) | | `combobox-arrow` | Popup arrow | | `combobox-backdrop` | Full-screen backdrop | ### Customization Examples ```css /* Widen the popup */ [data-slot="combobox-content"] { @apply min-w-[20rem]; } /* Custom highlighted item style */ [data-slot="combobox-item"][data-highlighted] { @apply bg-primary text-primary-foreground; } ``` ```tsx {/* Override popup alignment */} {/* ... */} ``` ## API Reference ### Combobox Root component that manages filtering, selection, and open/close state. All [Base UI Combobox.Root props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxInput Text input with optional trigger and clear buttons, wrapped in an `InputGroup`. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `showTrigger` | `boolean` | `true` | Show the dropdown trigger button | | `showClear` | `boolean` | `false` | Show the clear selection button | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Additional content after the input | All [Base UI Combobox.Input props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxChipsInput Minimal text input for use within the `ComboboxChips` container. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Input props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxTrigger Button that toggles the popup open or closed. Renders a chevron-down icon by default. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Custom icon (replaces default chevron) | All [Base UI Combobox.Trigger props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxClear Button that clears the current selection. Renders an X icon by default. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Custom icon (replaces default X) | All [Base UI Combobox.Clear props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxValue Displays the selected value text. All [Base UI Combobox.Value props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxContent Positioned popup that contains the list. Wraps `Combobox.Portal`, `Combobox.Positioner`, and `Combobox.Popup`. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `side` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Side of the anchor to position on | | `sideOffset` | `number` | `4` | Distance from the anchor | | `align` | `"start" \| "center" \| "end"` | `"start"` | Alignment along the side axis | | `alignOffset` | `number` | `0` | Offset along the alignment axis | | `anchor` | `ComboboxPrimitive.Positioner.Props["anchor"]` | - | Custom anchor element | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Popup props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxList Scrollable list container for combobox items. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.List props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxItem Individual selectable option. Includes a check icon indicator when selected. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Item content | All [Base UI Combobox.Item props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxEmpty Message shown when no items match the current filter. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Empty props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxGroup Groups related combobox items together. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Group props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxGroupLabel Label for a group of items. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.GroupLabel props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxSeparator Visual separator between groups. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Separator props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxIcon Icon element within the combobox. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Icon props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxChips Container for selected value chips in multi-select mode. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Chips props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxChip Individual chip representing a selected value. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Chip props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxChipRemove Button to remove a chip. Renders an X icon by default. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Custom icon (replaces default X) | All [Base UI Combobox.ChipRemove props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxStatus Screen-reader-only status message that announces changes. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Status props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxArrow Arrow element pointing from the popup to the trigger. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Arrow props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxBackdrop Full-screen backdrop rendered behind the popup. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Combobox.Backdrop props](https://base-ui.com/react/components/combobox) are forwarded via `...props`. ### ComboboxCollection Re-export of `ComboboxPrimitive.Collection` for defining static item collections. ### useComboboxFilter Re-export of `ComboboxPrimitive.useFilter` hook for custom filtering logic. ### useComboboxAnchor Utility hook that returns a ref for anchoring the combobox popup to a custom element. ```tsx import { useComboboxAnchor } from "@/components/ui/combobox" const anchorRef = useComboboxAnchor() ``` ## Accessibility ### Keyboard Interactions | Key | Action | | ------------ | --------------------------------------------------------------- | | `ArrowDown` | Opens the popup (if closed) or moves to the next item | | `ArrowUp` | Opens the popup (if closed) or moves to the previous item | | `Enter` | Selects the highlighted item and closes the popup | | `Escape` | Closes the popup | | `Home` | Moves to the first item in the list | | `End` | Moves to the last item in the list | | `Tab` | Closes the popup and moves focus to the next element | | `Backspace` | Removes the last chip (in multi-select chips mode) | ### ARIA Attributes - The input has `role="combobox"` with `aria-expanded` indicating popup state. - `aria-activedescendant` tracks the currently highlighted item. - `aria-autocomplete` indicates the filtering behavior. - `ComboboxContent` has `role="listbox"` for the list of options. - `ComboboxItem` has `role="option"` with `aria-selected` for selected state and `aria-disabled` for disabled items. - `ComboboxGroup` uses `role="group"` with `aria-labelledby` linked to the group label. - `ComboboxStatus` provides a live region for screen reader announcements. - `ComboboxClear` has `aria-label="Clear selection"` for screen reader users. # Dialog > A modal dialog with sheet variant built on Base UI URL: https://prototyper-ui.com/docs/components/dialog Base UI reference: https://base-ui.com/react/components/dialog ```tsx import { Button } from "@/components/ui/button" import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import { FieldLabel } from "@/components/ui/field" import { TextField, Input } from "@/components/ui/textfield" export default function DialogDemo() { return ( }> Sign up... Sign up
First Name Last Name
}> Save changes
) } ``` ## Installation ```bash pnpm dlx shadcn@latest add https://prototyper-ui.com/r/dialog.json ``` This will add the following files to your project: - `components/ui/dialog.tsx` ## Usage ```tsx import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, } from "@/components/ui/dialog" Open Dialog Title Dialog description. ``` ## Anatomy ```tsx {/* your content */} ``` | Sub-component | `data-slot` | Purpose | Required | | ------------------ | -------------------- | ------------------------------------------------- | -------- | | `Dialog` | `dialog` | Root provider, manages open/close state | Yes | | `DialogTrigger` | `dialog-trigger` | Button that opens the dialog | Yes | | `DialogPortal` | `dialog-portal` | Renders children into a portal | No | | `DialogOverlay` | `dialog-overlay` | Backdrop behind the dialog | No | | `DialogContent` | `dialog-content` | The dialog popup panel | Yes | | `DialogHeader` | `dialog-header` | Flex container for title and description | No | | `DialogTitle` | `dialog-title` | Accessible title for the dialog | Yes | | `DialogDescription`| `dialog-description` | Accessible description for the dialog | No | | `DialogFooter` | `dialog-footer` | Flex container for action buttons | No | | `DialogClose` | `dialog-close` | Button that closes the dialog | No | ## Examples ### Alert Dialog ```tsx import { Button } from "@/components/ui/button" import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" export default function AlertDialogDemo() { return ( }> Delete... Delete file This will permanently delete the selected file. Continue? }> Cancel }> Delete ) } ``` ### Sheet ```tsx import { Button } from "@/components/ui/button" import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import { FieldLabel } from "@/components/ui/field" import { Switch } from "@/components/ui/switch" import { TextField, Input } from "@/components/ui/textfield" export default function DialogSheet() { return ( }> Open Settings Settings Manage your account preferences and notification settings.

Profile

Display Name Email

Notifications

Email notifications
Marketing emails
}>Save changes
) } ``` ## Styling ### Data Slots Use `data-slot` attributes to target specific parts of the dialog: | Slot name | Element | | -------------------- | ---------------------------------------- | | `dialog` | Root provider (no DOM element rendered) | | `dialog-trigger` | The trigger button | | `dialog-portal` | Portal wrapper | | `dialog-overlay` | Backdrop overlay | | `dialog-content` | The popup panel | | `dialog-header` | Header container (title + description) | | `dialog-title` | Title heading | | `dialog-description` | Description paragraph | | `dialog-footer` | Footer container (action buttons) | | `dialog-close` | Close button(s) | ### Customization Examples ```css /* Make dialogs wider by default */ [data-slot="dialog-content"] { @apply sm:max-w-lg; } /* Custom overlay color */ [data-slot="dialog-overlay"] { @apply bg-black/30; } ``` ```tsx {/* Override width via className */} {/* ... */} ``` ## API Reference ### Dialog Root component that manages open/close state. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `open` | `boolean` | - | Controlled open state | | `onOpenChange` | `(open: boolean) => void` | - | Callback when open state changes | | `defaultOpen` | `boolean` | `false` | Initial open state for uncontrolled usage | | `modal` | `boolean` | `true` | Whether the dialog is modal | All [Base UI Dialog.Root props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogTrigger Button that opens the dialog when clicked. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Dialog.Trigger props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogContent The popup panel rendered inside a portal with an overlay backdrop. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `showCloseButton` | `boolean` | `true` | Whether to show the X close button | | `side` | `"top" \| "bottom" \| "left" \| "right"` | - | Turns the dialog into a sheet from this side | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Dialog content | All [Base UI Dialog.Popup props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogHeader Flex column container for title and description. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Header content | All standard `div` props are forwarded via `...props`. ### DialogFooter Flex row container for action buttons. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `showCloseButton` | `boolean` | `false` | Whether to render a "Close" button | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Footer content | All standard `div` props are forwarded via `...props`. ### DialogTitle Accessible title for the dialog, rendered as a heading. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Dialog.Title props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogDescription Accessible description rendered below the title. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Dialog.Description props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogClose Button that closes the dialog when clicked. All [Base UI Dialog.Close props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogOverlay Backdrop overlay behind the dialog. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | All [Base UI Dialog.Backdrop props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ### DialogPortal Renders children into a React portal. All [Base UI Dialog.Portal props](https://base-ui.com/react/components/dialog) are forwarded via `...props`. ## Accessibility ### Keyboard Interactions | Key | Action | | ----------- | ---------------------------------------------------------------- | | `Escape` | Closes the dialog | | `Tab` | Moves focus to the next focusable element within the dialog | | `Shift+Tab` | Moves focus to the previous focusable element within the dialog | ### ARIA Attributes - `DialogContent` receives `role="dialog"` (or `role="alertdialog"` when used as an alert dialog). - `aria-modal="true"` is set when the dialog is modal. - `aria-labelledby` is automatically linked to `DialogTitle`. - `aria-describedby` is automatically linked to `DialogDescription`. - Focus is trapped inside the dialog while it is open. - Focus returns to the trigger element when the dialog closes.
# Field > Form field wrapper with label, description, and error message URL: https://prototyper-ui.com/docs/components/field Base UI reference: https://base-ui.com/react/components/field ## Installation ```bash pnpm dlx shadcn@latest add https://prototyper-ui.com/r/field.json ``` This will add the following files to your project: - `components/ui/field.tsx` ## Usage ```tsx import { Field, FieldLabel, FieldDescription } from "@/components/ui/field" Email Enter your email address. ``` ## Anatomy ```tsx
{/* input, checkbox, or other control */}
``` Or with `FieldGroup` for grouped inputs: ```tsx {/* grouped inputs or controls */} ``` | Sub-component | `data-slot` | Purpose | Required | | ------------------ | -------------------- | ------------------------------------------------------- | -------- | | `Field` | `field` | Root wrapper, provides layout and orientation | Yes | | `FieldLabel` | `field-label` | Label for the field control | No | | `FieldTitle` | `field-label` | Non-interactive label text (renders as `div`) | No | | `FieldDescription` | `field-description` | Helper/description text | No | | `FieldError` | `field-error` | Validation error message with `role="alert"` | No | | `FieldGroup` | `field-group` | Styled group container for composed inputs | No | | `FieldContent` | `field-content` | Content wrapper for description and error | No | | `FieldSet` | `field-set` | Fieldset element for grouping multiple fields | No | | `FieldLegend` | `field-legend` | Legend for a fieldset | No | | `FieldSeparator` | `field-separator` | Visual separator between fields | No | ## Examples This component does not have standalone examples. It is used as a building block within [TextField](/docs/components/textfield), [NumberField](/docs/components/numberfield), [Checkbox](/docs/components/checkbox), [Radio Group](/docs/components/radio-group), and other form components. ## Styling ### Data Slots Use `data-slot` attributes to target specific parts of the field: | Slot name | Element | | -------------------- | ------------------------------------------ | | `field` | Root wrapper div | | `field-label` | Label element | | `field-description` | Description paragraph | | `field-error` | Error message container | | `field-group` | Grouped input container | | `field-content` | Content wrapper (description + error) | | `field-set` | Fieldset element | | `field-legend` | Legend element | | `field-separator` | Visual separator | ### Customization Examples ```css /* Change label styling globally */ [data-slot="field-label"] { @apply text-base font-semibold; } /* Style error messages */ [data-slot="field-error"] { @apply text-xs font-medium; } ``` ```tsx {/* Override field orientation */} Name ``` ## API Reference ### Field Root wrapper that provides layout direction and grouping for form controls. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `orientation` | `"vertical" \| "horizontal" \| "responsive"` | `"vertical"` | Layout direction of the field | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Field content | All standard `div` props are forwarded via `...props`. ### FieldLabel Label element that wraps or precedes a form control. Built on the `Label` component. | Prop | Type | Default | Description | | --- | --- | --- | --- | | `className` | `string` | - | Additional CSS classes | | `children` | `React.ReactNode` | - | Label content | All Label props are forwarded via `...props`. ### FieldTitle Non-interactive label text rendered as a `div` instead of a `