Components
Next-Admin exports a set of UI components which are, for most of those, extending Radix UI primitives. These components are available through the @premieroctet/next-admin/components
import.
Button
The button element accepts all the base button
tag attributes and extends it with the following:
Name | Description | Default Value |
---|---|---|
variant | The button variant. Possible values are `default`, `destructive`, `destructiveOutline`, `outline`, `secondary`, `ghost`, `link` | default |
size | The button size. Possible values are `default`, `sm`, `lg` | - |
icon | A boolean indicating the presence of an icon | - |
asChild | A boolean to render a Radix Slot component | - |
loading | A boolean to render a spinner | - |
BaseInput
The input component rendered in the Form component. It accepts all the base input
tag attributes.
Switch
The Radix Switch component.
Select
The Radix Select component.
Checkbox
An implementation of the Radix Checkbox component. It accepts all the props of the Checkbox Root component, and the following:
Name | Description |
---|---|
indeterminate | A boolean to render the checkbox in an indeterminate state |
Dropdown
The Radix Dropdown component.
Table
The Radix Table component.
Tooltip
The Radix Tooltip component.
Breadcrumbs
The Breadcrumb
accepts the following options:
<Breadcrumb
breadcrumbItems={[
{
href: "/admin/post",
label: "Posts",
icon: "BlogIcon",
current: false,
},
{
href: "/admin/post/batch-upload",
label: "Batch Upload",
current: true,
},
]}
/>
```
## Spinner
The `Spinner` component is used to display a loading spinner.
# Inputs
The inputs used across next-admin are available to be used in custom pages. These components are available through the `@premieroctet/next-admin/inputs` import.
Most expect to be wrapped within a `FormDataProvider`:
```tsx
// pages/admin/coupons/batch-upload.tsx
import { FormDataProvider, FileWidget } from "@premieroctet/next-admin/inputs";
export default function BatchUpload() {
return (
<FormDataProvider>
<FileWidget name="file" />
</FormDataProvider>
);
}
```
## `FileWidget`
The `FileWidget` component is used to upload files.
## `RichTextField`
The `RichTextField` component is used to edit rich text content.
## `SelectWidget`
The `SelectWidget` component is used to select a value from a list of options.
## `TextareaWidget`
The `TextareaWidget` component is used to edit a text area.
## `CheckboxWidget`
The `CheckboxWidget` component is used to select a boolean value.
## `DateTimeWidget`
The `DateTimeWidget` component is used to select a date and time.
## `DateWidget`
The `DateWidget` component is used to select a date.
## `JsonField`
The `JsonField` component is used to edit a JSON object.
## `NullField`
The `NullField` component is used to select a null value.
## `ArrayField`
The `ArrayField` component is used to edit an array of values.