Getting Started
Components
- Advanced Toast
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- Carousel
- ChatButton
- ChatInput
- ChatMessage
- ChatTypingIndicator
- ChatWindow
- CheckboxSelect
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- Date Field
- Dropdown
- ElasticHeight
- ExpandableCard
- Filter
- Form Control
- Form Label
- Frame
- HamburgerIcon
- Heading
- Image
- Link
- Loader
- Number Field
- Pagination
- Password
- Phone Field
- Popin
- Portal
- Prose
- Radio Group
- Radio
- Range
- Scrollbar
- Select
- SidebarLayout
- SliderFrame
- Spinner
- Switch
- Tabs
- Tag
- TextField
- Tooltip
- ValidationMessage
Travel
Activities
'use client';
import { useState } from 'react';
import { CheckboxSelect } from '@/ui/forms/CheckboxSelect';
const statusOptions = [
{ value: 'open', label: 'Open' },
{ value: 'fixed', label: 'Fixed' },
{ value: 'in-progress', label: 'In Progress' },
{ value: 'closed', label: 'Closed' },
];
export function CheckboxSelectDemo() {
const [status, setStatus] = useState<string[]>(['open']);
const [categories, setCategories] = useState<string[]>([]);
return (
<div className="space-y-24" style={{ minWidth: 300 }}>
<CheckboxSelect
label="Status"
placeholder="Select statuses..."
options={statusOptions}
value={status}
onChange={(_, v) => setStatus(v)}
/>
<CheckboxSelect
label="Category"
placeholder="Select categories..."
groups={[
{
label: 'Travel',
options: [
{ value: 'flight', label: 'Flight' },
{ value: 'hotel', label: 'Hotel' },
],
},
{
label: 'Activities',
options: [
{ value: 'ski', label: 'Ski' },
{ value: 'golf', label: 'Golf' },
{ value: 'spa', label: 'Spa' },
],
},
]}
value={categories}
onChange={(_, v) => setCategories(v)}
renderValue={(vals) => `${vals.length} selected`}
/>
<CheckboxSelect
label="Priority"
options={[
{ value: 'high', label: 'High' },
{ value: 'medium', label: 'Medium' },
{ value: 'low', label: 'Low' },
]}
validationStatus="error"
errorMessage="Please select at least one priority"
/>
<CheckboxSelect label="Tags" options={statusOptions} value={['open']} disabled />
</div>
);
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/checkbox-select.json
Usage
import { CheckboxSelect } from '@/ui/forms/CheckboxSelect';
export function Component() {
return (
<CheckboxSelect
label="Status"
options={[
{ value: 'open', label: 'Open' },
{ value: 'fixed', label: 'Fixed' },
]}
/>
);
}API Reference
CheckboxSelect
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | undefined | Label displayed above the trigger |
description | string | undefined | Secondary description shown next to the label |
placeholder | string | "Select..." | Text shown in the trigger when no values are selected |
options | CheckboxSelectOption[] | undefined | Flat list of options. Use groups instead for grouped options |
groups | CheckboxSelectGroup[] | undefined | Grouped options with optional group labels |
value | Value[] | undefined | Controlled selected values |
onChange | (name: string, value: Value[]) => void | undefined | Called with the updated selection when a checkbox is toggled |
renderValue | (selected: Value[]) => ReactNode | undefined | Custom renderer for the trigger label when values are selected |
disabled | boolean | false | Disables the trigger and all checkboxes |
required | boolean | false | Marks the field as required |
validationStatus | "default" | "error" | "success" | "default" | Visual validation state of the trigger |
errorMessage | string | undefined | Error text shown below when validationStatus is "error" |
className | string | undefined | Additional CSS classes on the outer wrapper |
CheckboxSelectOption
| Prop | Type | Description |
|---|---|---|
value | Value | The option's value |
label | ReactNode | Label shown in the panel |
CheckboxSelectGroup
| Prop | Type | Description |
|---|---|---|
label | ReactNode | Optional group heading |
options | CheckboxSelectOption[] | Options within this group |
Notes
- The dropdown closes when clicking outside the component.
- Pass
groupsinstead ofoptionsto render options under labeled sections. - Use
renderValueto customize the summary shown in the trigger (e.g. "3 selected"). - The trigger inherits the same border/pill styling as
TextFieldandSelect.