ChipGroup
formnewThe same selection list as CheckboxGroup, wearing pill-shaped chips instead. Identical props, so you can swap one for the other by renaming the component. It renders only the chips — no card, heading or button — so it slots straight into a form or a wizard step. Set multiple={false} to make it behave like a radio group.
Set Company Working days
Select your company working days, and uncheck non-working days
1Installation
Install the package:
$npm install piece-ui@alpha
Import the component:
tsx
1import { ChipGroup } from "piece-ui";2Usage
Give it a list — that's it
tsx
1import { ChipGroup } from "piece-ui";
2
3export default function Example() {
4 return (
5 <ChipGroup
6 options={["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]}
7 defaultValue={["Monday", "Tuesday"]}
8 onChange={(days) => console.log(days)}
9 />
10 );
11}Single select
tsx
1import { ChipGroup } from "piece-ui";
2
3export default function Example() {
4 return (
5 <ChipGroup
6 options={["Daily", "Weekly", "Monthly"]}
7 defaultValue={["Weekly"]}
8 multiple={false}
9 onChange={([plan]) => console.log(plan)}
10 />
11 );
12}Restyled — colour, size, weight
tsx
1import { ChipGroup } from "piece-ui";
2
3export default function Example() {
4 return (
5 <ChipGroup
6 options={["Monday", "Tuesday", "Wednesday"]}
7 defaultValue={["Monday"]}
8 accentColor="#10b981"
9 chipColor="#f9fafb"
10 borderColor="#e5e7eb"
11 labelColor="#374151"
12 size="lg"
13 weight="bold"
14 />
15 );
16}As one field in a form — nothing else comes with it
tsx
1import { useState } from "react";
2import { ChipGroup } from "piece-ui";
3
4const DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
5
6// ChipGroup renders ONLY the chips — it is just another form field.
7export default function SettingsForm() {
8 const [days, setDays] = useState(["Monday", "Tuesday"]);
9
10 return (
11 <form onSubmit={(e) => e.preventDefault()}>
12 <label className="mb-2 block font-medium">Working days</label>
13 <ChipGroup options={DAYS} value={days} onChange={setDays} />
14
15 <label className="mt-6 mb-2 block font-medium">Timezone</label>
16 <input name="tz" className="w-full rounded-lg border px-3 py-2" />
17
18 <button type="submit" className="mt-6">Save</button>
19 </form>
20 );
21}3Props
| Prop | Type |
|---|---|
optionsreq | (string | { label, value?, disabled? })[] |
value | string[] |
defaultValue | string[] |
onChange | (value: string[]) => void |
onSelect | (value: string, selected: boolean) => void |
multiple | boolean |
size | "sm" | "md" | "lg" |
weight | "normal" | "medium" | "semibold" | "bold" |
accentColor | string |
selectedLabelColor | string |
chipColor | string |
borderColor | string |
labelColor | string |
fontFamily | string |
disabled | boolean |