-
Notifications
You must be signed in to change notification settings - Fork 787
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
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 0833ff6
feat: create checkboxGroup to handle arrays and use radioGroup variants
TribeWeb 926b783
chore: add checkboxGroup to all component and types lists
TribeWeb 0b531fa
chore: rerun tests
TribeWeb ac8ca04
docs: add missing description and category
TribeWeb a60a2bb
Update docs/content/3.components/checkbox-group.md
TribeWeb b180da5
Merge branch 'v3' into checkBoxGroup
benjamincanac 3248184
chore: refactor after #3855
benjamincanac 4980a65
docs(CheckboxGroup): add to form elements example
romhml e09e3be
fix: test/components/CheckboxGroup.spec.ts
TribeWeb e23a21f
fix: imports in test/components/CheckboxGroup.spec.ts
TribeWeb 7a7180c
docs(CheckboxGroup): fix initial modelValue
romhml 46b0ace
feat: Apply new variant styling
TribeWeb e529936
feat: refactor to reuse UCheckbox
TribeWeb e4d8719
feat: share and reuse styling between both components
TribeWeb cf7f46d
chore: update playground with variant chooser
TribeWeb e7a5aa4
chore: new snapshots
TribeWeb f5d8f7d
chore: new snapshots
TribeWeb 27c3046
chore: fixed my initial mistakes in test file - still failing 4 tests
TribeWeb 37abbc8
Merge branch 'checkBoxGroup' of https://github.com/TribeWeb/ui into cβ¦
TribeWeb 0fbb36f
Merge branch 'v3' into checkBoxGroup
TribeWeb c8eef60
chore: refactor to use provide/inject as per other group components
TribeWeb aa1e01f
docs: update to include table and card variants
TribeWeb 69ab7e1
chore: refactor to restore `Primitive` root element on Checkbox and kβ¦
TribeWeb 74b06d2
Merge branch 'v3' into checkBoxGroup
TribeWeb 87fecc7
chore: update snapshots
TribeWeb 30d769f
chore: refactor using vueUse-createReusableTemplate to reduce repetition
TribeWeb 8d7aabf
fix: reintroduce indeterminate state & disabled state
TribeWeb 6323990
fix: default and model test values
TribeWeb 3c4fa12
chore: update snapshots
TribeWeb 275f3fb
Merge branch 'v3' into checkBoxGroup
TribeWeb d9217f5
fix: removed unecessary v-model repetition
TribeWeb b31c0d4
Merge branch 'v3' into checkBoxGroup
TribeWeb c84e410
fix: revert v-model
TribeWeb f732747
Merge branch 'v3' into checkBoxGroup
TribeWeb 07d4e69
Merge branch 'v3' into pr/3862
benjamincanac b659b91
up
benjamincanac b6cdb4c
up
benjamincanac 3748e40
up
benjamincanac f52bb87
up
benjamincanac 5a4479a
up
benjamincanac bf5b545
up
benjamincanac c906db0
up
benjamincanac 22db591
up
benjamincanac 6fa0ada
test(CheckboxGroup): fix form tests
romhml File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
benjamincanac marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--- | ||
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 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.