diff --git a/docs/content/docs/2.components/checkbox-group.md b/docs/content/docs/2.components/checkbox-group.md index 3d79f203b0..f614939134 100644 --- a/docs/content/docs/2.components/checkbox-group.md +++ b/docs/content/docs/2.components/checkbox-group.md @@ -64,6 +64,7 @@ You can also pass an array of objects with the following properties: - `description?: string`{lang="ts-type"} - [`value?: string`{lang="ts-type"}](#value-key) - `disabled?: boolean`{lang="ts-type"} +- [`icon?: string`{lang="ts-type"}](#with-icon-in-items) - `class?: any`{lang="ts-type"} - `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, icon?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"} @@ -335,6 +336,55 @@ props: --- :: +## Examples + +### With icon in items :badge{label="Soon" class="align-text-top"} + +Use the `icon` property in the items to display an icon above the label when `indicator` is `hidden`. + +::note +When the indicator is visible, the icon replaces the check mark inside it instead. +:: + +::component-code +--- +prettier: true +ignore: + - modelValue + - items + - indicator +external: + - items + - modelValue +externalTypes: + - CheckboxGroupItem[] +items: + variant: + - card + - table +props: + modelValue: + - 'system' + color: 'primary' + variant: 'table' + indicator: 'hidden' + orientation: 'horizontal' + items: + - label: 'System' + icon: 'i-lucide-monitor' + value: 'system' + class: 'w-20' + - label: 'Light' + icon: 'i-lucide-sun' + value: 'light' + class: 'w-20' + - label: 'Dark' + icon: 'i-lucide-moon' + value: 'dark' + class: 'w-20' +--- +:: + ## API ### Props diff --git a/docs/content/docs/2.components/checkbox.md b/docs/content/docs/2.components/checkbox.md index 5704e5125c..ca810960a7 100644 --- a/docs/content/docs/2.components/checkbox.md +++ b/docs/content/docs/2.components/checkbox.md @@ -194,14 +194,21 @@ props: Use the `indicator` prop to change the position or hide the indicator. Defaults to `start`. +::note +When `indicator` is `hidden`, the icon is displayed above the label instead. :badge{label="Soon" color="info" class="float-right ms-auto text-right"} +:: + ::component-code --- +prettier: true ignore: - label + - icon - defaultValue props: indicator: 'end' variant: 'card' + icon: 'i-lucide-heart' defaultValue: true label: Check me --- diff --git a/docs/content/docs/2.components/radio-group.md b/docs/content/docs/2.components/radio-group.md index 40fc431639..95c8a91575 100644 --- a/docs/content/docs/2.components/radio-group.md +++ b/docs/content/docs/2.components/radio-group.md @@ -61,8 +61,9 @@ You can also pass an array of objects with the following properties: - `description?: string`{lang="ts-type"} - [`value?: string`{lang="ts-type"}](#value-key) - `disabled?: boolean`{lang="ts-type"} +- [`icon?: string`{lang="ts-type"}](#with-icon-in-items) - `class?: any`{lang="ts-type"} -- `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, icon?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"} ::component-code --- @@ -290,6 +291,54 @@ props: --- :: +## Examples + +### With icon in items :badge{label="Soon" class="align-text-top"} + +Use the `icon` property in the items to display an icon above the label when `indicator` is `hidden`. + +::note +A radio has no icon inside its indicator, so `icon` only renders when the indicator is hidden. +:: + +::component-code +--- +prettier: true +ignore: + - modelValue + - items + - indicator +external: + - items + - modelValue +externalTypes: + - RadioGroupItem[] +items: + variant: + - card + - table +props: + modelValue: 'system' + color: 'primary' + indicator: 'hidden' + variant: 'table' + orientation: 'horizontal' + items: + - label: 'System' + icon: 'i-lucide-monitor' + value: 'system' + class: 'w-20' + - label: 'Light' + icon: 'i-lucide-sun' + value: 'light' + class: 'w-20' + - label: 'Dark' + icon: 'i-lucide-moon' + value: 'dark' + class: 'w-20' +--- +:: + ## API ### Props diff --git a/playgrounds/nuxt/app/pages/components/checkbox-group.vue b/playgrounds/nuxt/app/pages/components/checkbox-group.vue index 14033d2b3d..f7387bf142 100644 --- a/playgrounds/nuxt/app/pages/components/checkbox-group.vue +++ b/playgrounds/nuxt/app/pages/components/checkbox-group.vue @@ -32,6 +32,11 @@ const itemsWithDescription = [ { value: '2', label: 'Option 2', description: 'Description 2' }, { value: '3', label: 'Option 3', description: 'Description 3' } ] +const itemsWithIcon = [ + { value: '1', label: 'System', icon: 'i-lucide-monitor' }, + { value: '2', label: 'Light', icon: 'i-lucide-sun' }, + { value: '3', label: 'Dark', icon: 'i-lucide-moon' } +]