Skip to content

feat(CheckboxGroup): new component #3862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0ab5e50
docs: add page for UCheckboxGroup
TribeWeb Apr 11, 2025
0833ff6
feat: create checkboxGroup to handle arrays and use radioGroup variants
TribeWeb Apr 11, 2025
926b783
chore: add checkboxGroup to all component and types lists
TribeWeb Apr 11, 2025
0b531fa
chore: rerun tests
TribeWeb Apr 11, 2025
ac8ca04
docs: add missing description and category
TribeWeb Apr 12, 2025
a60a2bb
Update docs/content/3.components/checkbox-group.md
TribeWeb Apr 12, 2025
b180da5
Merge branch 'v3' into checkBoxGroup
benjamincanac Apr 13, 2025
3248184
chore: refactor after #3855
benjamincanac Apr 13, 2025
4980a65
docs(CheckboxGroup): add to form elements example
romhml Apr 13, 2025
e09e3be
fix: test/components/CheckboxGroup.spec.ts
TribeWeb Apr 13, 2025
e23a21f
fix: imports in test/components/CheckboxGroup.spec.ts
TribeWeb Apr 13, 2025
7a7180c
docs(CheckboxGroup): fix initial modelValue
romhml Apr 15, 2025
46b0ace
feat: Apply new variant styling
TribeWeb Apr 16, 2025
e529936
feat: refactor to reuse UCheckbox
TribeWeb Apr 16, 2025
e4d8719
feat: share and reuse styling between both components
TribeWeb Apr 16, 2025
cf7f46d
chore: update playground with variant chooser
TribeWeb Apr 16, 2025
e7a5aa4
chore: new snapshots
TribeWeb Apr 16, 2025
f5d8f7d
chore: new snapshots
TribeWeb Apr 16, 2025
27c3046
chore: fixed my initial mistakes in test file - still failing 4 tests
TribeWeb Apr 16, 2025
37abbc8
Merge branch 'checkBoxGroup' of https://github.com/TribeWeb/ui into c…
TribeWeb Apr 16, 2025
0fbb36f
Merge branch 'v3' into checkBoxGroup
TribeWeb Apr 16, 2025
c8eef60
chore: refactor to use provide/inject as per other group components
TribeWeb Apr 17, 2025
aa1e01f
docs: update to include table and card variants
TribeWeb Apr 17, 2025
69ab7e1
chore: refactor to restore `Primitive` root element on Checkbox and k…
TribeWeb Apr 17, 2025
74b06d2
Merge branch 'v3' into checkBoxGroup
TribeWeb Apr 17, 2025
87fecc7
chore: update snapshots
TribeWeb Apr 17, 2025
30d769f
chore: refactor using vueUse-createReusableTemplate to reduce repetition
TribeWeb Apr 19, 2025
8d7aabf
fix: reintroduce indeterminate state & disabled state
TribeWeb Apr 19, 2025
6323990
fix: default and model test values
TribeWeb Apr 19, 2025
3c4fa12
chore: update snapshots
TribeWeb Apr 19, 2025
275f3fb
Merge branch 'v3' into checkBoxGroup
TribeWeb Apr 19, 2025
d9217f5
fix: removed unecessary v-model repetition
TribeWeb Apr 20, 2025
b31c0d4
Merge branch 'v3' into checkBoxGroup
TribeWeb Apr 20, 2025
c84e410
fix: revert v-model
TribeWeb Apr 20, 2025
f732747
Merge branch 'v3' into checkBoxGroup
TribeWeb Apr 21, 2025
07d4e69
Merge branch 'v3' into pr/3862
benjamincanac Apr 21, 2025
b659b91
up
benjamincanac Apr 21, 2025
b6cdb4c
up
benjamincanac Apr 22, 2025
3748e40
up
benjamincanac Apr 22, 2025
f52bb87
up
benjamincanac Apr 22, 2025
5a4479a
up
benjamincanac Apr 22, 2025
bf5b545
up
benjamincanac Apr 22, 2025
c906db0
up
benjamincanac Apr 22, 2025
22db591
up
benjamincanac Apr 22, 2025
6fa0ada
test(CheckboxGroup): fix form tests
romhml Apr 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 306 additions & 0 deletions docs/content/3.components/checkbox-group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
---
title: CheckboxGroup
description: A set of checklist buttons to select multiple option from a list.
category: form
links:
- label: CheckboxGroup
icon: i-custom-reka-ui
to: https://reka-ui.com/docs/components/checkbox-group
- label: GitHub
icon: i-simple-icons-github
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/CheckboxGroup.vue
---


## Usage

Use the `v-model` directive to control the value of the CheckboxGroup or the `default-value` prop to set the initial value when you do not need to control its state.

### Items

Use the `items` prop as an array of strings or numbers:

::component-code
---
prettier: true
ignore:
- modelValue
- items
external:
- items
- modelValue
externalTypes:
- CheckboxGroupItem[]
- CheckboxGroupValue
props:
modelValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

You can also pass an array of objects with the following properties:

- `label?: string`{lang="ts-type"}
- `description?: string`{lang="ts-type"}
- [`value?: string`{lang="ts-type"}](#value-key)
- `disabled?: boolean`{lang="ts-type"}

::component-code
---
ignore:
- modelValue
- items
external:
- items
- modelValue
externalTypes:
- CheckboxGroupItem[]
- CheckboxGroupValue
props:
modelValue: 'system'
items:
- label: 'System'
description: 'This is the first option.'
value: 'system'
- label: 'Light'
description: 'This is the second option.'
value: 'light'
- label: 'Dark'
description: 'This is the third option.'
value: 'dark'
---
::

::caution
When using objects, you need to reference the `value` property of the object in the `v-model` directive or the `default-value` prop.
::

### Value Key

You can change the property that is used to set the value by using the `value-key` prop. Defaults to `value`.

::component-code
---
ignore:
- modelValue
- items
- valueKey
external:
- items
- modelValue
externalTypes:
- CheckboxGroupItem[]
- CheckboxGroupValue
props:
modelValue: 'light'
valueKey: 'id'
items:
- label: 'System'
description: 'This is the first option.'
id: 'system'
- label: 'Light'
description: 'This is the second option.'
id: 'light'
- label: 'Dark'
description: 'This is the third option.'
id: 'dark'
---
::

### Legend

Use the `legend` prop to set the legend of the CheckboxGroup.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
externalTypes:
- CheckboxGroupItem[]
props:
legend: 'Theme'
defaultValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

### Color

Use the `color` prop to change the color of the CheckboxGroup.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
externalTypes:
- CheckboxGroupItem[]
props:
color: neutral
defaultValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

### Variant :badge{label="Not released" class="align-text-top"}

Use the `variant` prop to change the variant of the CheckboxGroup.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
props:
color: 'primary'
variant: 'table'
defaultValue: 'pro'
items:
- label: 'Pro'
value: 'pro'
description: 'Tailored for indie hackers, freelancers and solo founders.'
- label: 'Startup'
value: 'startup'
description: 'Best suited for small teams, startups and agencies.'
- label: 'Enterprise'
value: 'enterprise'
description: 'Ideal for larger teams and organizations.'
---
::

### Size

Use the `size` prop to change the size of the CheckboxGroup.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
externalTypes:
- CheckboxGroupItem[]
props:
size: 'xl'
variant: 'list'
defaultValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

### Orientation

Use the `orientation` prop to change the orientation of the CheckboxGroup. Defaults to `vertical`.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
externalTypes:
- CheckboxGroupItem[]
props:
orientation: 'horizontal'
variant: 'list'
defaultValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

### Indicator :badge{label="Not released" class="align-text-top"}

Use the `indicator` prop to change the position or hide the indicator. Defaults to `start`.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
externalTypes:
- CheckboxGroupItem[]
props:
indicator: 'end'
variant: 'card'
defaultValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

### Disabled

Use the `disabled` prop to disable the CheckboxGroup.

::component-code
---
prettier: true
ignore:
- defaultValue
- items
external:
- items
externalTypes:
- CheckboxGroupItem[]
props:
disabled: true
defaultValue: 'System'
items:
- 'System'
- 'Light'
- 'Dark'
---
::

## API

### Props

:component-props

### Slots

:component-slots

### Emits

:component-emits

## Theme

:component-theme

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"pnpm": {
"onlyBuiltDependencies": [
"better-sqlite3",
"puppeteer",
"sharp"
],
"ignoredBuiltDependencies": [
Expand Down
1 change: 1 addition & 0 deletions playground-vue/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const components = [
'calendar',
'carousel',
'checkbox',
'checkbox-group',
'chip',
'collapsible',
'color-picker',
Expand Down
1 change: 1 addition & 0 deletions playground/app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const components = [
'calendar',
'carousel',
'checkbox',
'checkbox-group',
'chip',
'collapsible',
'color-picker',
Expand Down
Loading