ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β π shadcn/directory/cosscom/coss/components/toggle-group β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
npx shadcn@latest add @coss/toggle-group
</TabsPanel>
<TabsPanel value="manual">
<Steps>
<Step>Install the following dependencies:</Step>
npm install @base-ui-components/react
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="toggle-group" title="components/ui/toggle-group.tsx" /><Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsPanel> </CodeTabs>import { Toggle, ToggleGroup } from "@/components/ui/toggle-group"
<ToggleGroup>
<Toggle>Bold</Toggle>
<Toggle>Italic</Toggle>
<Toggle>Underline</Toggle>
</ToggleGroup>
If youβre already familiar with Radix UI and shadcn/ui, this guide highlights the small differences and similarities so you can get started with coss ui quickly.
| Component | Radix UI Prop | Base UI Prop |
| ------------- | ----------------------------------------- | -------------------------------------- |
| ToggleGroup | type (enum, "single" or "multiple") | multiple (boolean, default: false) |
type="multiple" β multiple on ToggleGrouptype="single" from ToggleGroupdefaultValueToggle going forward; ToggleGroupItem remains for legacycoss ui toggle group sizes are more compact compared to shadcn/ui, making them better suited for dense applications:
| Size | Height (shadcn/ui) | Height (coss ui) |
| --------- | ------------------ | ---------------- |
| sm | 32px | 28px |
| default | 36px | 32px |
| lg | - | 36px |
So, for example, if you were using the default size in shadcn/ui and you want to preserve the original height, you should use the lg size in coss ui.
β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ