--- title: "React Kit Components (shadcn/ui)" description: "Common form components, the confirm dialog, shadcn/ui primitives, icons, toasts and app shell components in the React kit, with a small usage example." --- # Components ## Overview You'll find the components in `resources/js/components`, split into three groups: | Folder | What it holds | | --- | --- | | `components/common/` | The kit's own components: `Common*` inputs, buttons, tooltip, icon and `ConfirmDialog` | | `components/ui/` | shadcn/ui primitives built on Radix UI (`button.tsx`, `dialog.tsx`, `select.tsx`, `sidebar.tsx`, …) | | `components/` | App shell and feature components (`AppSidebar`, `AppHeader`, `UserMenuContent`, `ErrorStatus`, …) | Start with the `Common*` components. They handle the label, `id`, `aria-*` attributes and error message for you, which turns a form field into a single line. Every file exports the component both as a named and as a default export. ::: tip If a component is only used by one page, put it in a `partials/` folder next to that page (for example `pages/tenants/partials/domain-modal.tsx`) rather than in `components/`. ::: ## Common form components | Component | File | Purpose | | --- | --- | --- | | `CommonInput` | `common-input.tsx` | Text, email, number, … input with label and error | | `CommonPassword` | `common-password.tsx` | Password input with a show/hide toggle | | `CommonTextarea` | `common-textarea.tsx` | Textarea with label and error | | `CommonSelect` | `common-select.tsx` | shadcn/ui `Select` with label; exports the `SelectOption` type | | `CommonRadio` | `common-radio.tsx` | Radio group from `SelectOption[]` | | `CommonCheckbox` | `common-checkbox.tsx` | Radix checkbox with label; notifies `
` dirty tracking | | `CommonLabel` | `common-label.tsx` | Label with `required` asterisk, `optional` tag and `hint` | | `CommonError` | `common-error.tsx` | `role="alert"` error text; renders nothing when empty | | `CommonButton` | `common-button.tsx` | `Button` with a `loading` state (disabled + spinner) | | `CommonButtonRow` | `common-button-row.tsx` | Save / Discard bar that appears when a form is dirty | | `CommonTooltip` | `common-tooltip.tsx` | Tooltip around any trigger | | `ConfirmDialog` | `confirm-dialog.tsx` | Promise-based confirm dialog, opened with `useConfirmDialog()` | The input components all work the same way: - Each one takes `label`, `error`, `required` and `disabled`. - If you leave out `id`, one is generated with `useId()`. - Any other prop (`autoFocus`, `tabIndex`, `className`, `data-test`, …) is passed to the underlying element. - In an Inertia ``, `name` and `error` are all you need. Prefill a field with `defaultValue`. - When there's no `` around it, control the value yourself with `value` + `onChange` / `onValueChange`. ::: details View props of each component | Component | Props | | --- | --- | | `CommonInput` | All `` props (`ComponentProps<'input'>`) + `label?`, `error?` | | `CommonPassword` | `` props except `type` + `label?`, `error?` | | `CommonTextarea` | `