Skip to main content
Version: v1 (Current)

Toggle Group

Generated from public Vue/TypeScript exports by pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commit fc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.

ToggleGroup​

import { ToggleGroup } from '@gxp-dev/app-ui'

Repository source

Props​

NameTypeRequired / defaultDescription
variant"default" | "outline" | null | undefined——
size"default" | "sm" | "lg" | null | undefined——
rovingFocusboolean | undefined—When false, navigating through the items using arrow keys will be disabled.
disabledboolean | undefined—When true, prevents the user from interacting with the toggle group and all its items.
orientationDataOrientation | undefined—The orientation of the component, which determines how focus moves: horizontal for left/right arrows and vertical for up/down arrows.
dirDirection | undefined—The reading direction of the combobox when applicable. <br> If omitted, inherits globally from ConfigProvider or assumes LTR (left-to-right) reading mode.
loopboolean | undefined—When loop and rovingFocus is true, keyboard navigation will loop from last item to first, and vice versa.
asChildboolean | undefined—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
asAsTag | Component | undefined—The element or component this component should render as. Can be overwritten by asChild.
namestring | undefined—The name of the field. Submitted with its owning form as part of a name/value pair.
requiredboolean | undefined—When true, indicates that the user must set the value before the owning form can be submitted.
typeSingleOrMultipleType | undefined—Determines whether a "single" or "multiple" items can be selected at a time. This prop will overwrite the inferred type from modelValue and defaultValue.
modelValueAcceptableValue | AcceptableValue[] | undefined—The controlled value of the active item(s). Use this when you need to control the state of the items. Can be binded with v-model
defaultValueAcceptableValue | AcceptableValue[] | undefined—The default active value of the item(s). Use when you do not need to control the state of the item(s).

Events​

NameTypeRequired / defaultDescription
update:modelValue[payload: AcceptableValue | AcceptableValue[]]——

Slots​

NameTypeRequired / defaultDescription
default{}——

Examples​

These are authored Storybook excerpts, not complete standalone modules. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.

Single​

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-vue-next'
import { ToggleGroup, ToggleGroupItem } from '.'
{
render: () => ({
components: { ToggleGroup, ToggleGroupItem, AlignLeft, AlignCenter, AlignRight },
setup() {
const alignment = ref('left')
return { alignment }
},
template: `
<ToggleGroup type="single" v-model="alignment">
<ToggleGroupItem value="left" aria-label="Align left">
<AlignLeft class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="center" aria-label="Align center">
<AlignCenter class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="right" aria-label="Align right">
<AlignRight class="h-4 w-4" />
</ToggleGroupItem>
</ToggleGroup>
`,
}),
}

Multiple​

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-vue-next'
import { ToggleGroup, ToggleGroupItem } from '.'
{
render: () => ({
components: { ToggleGroup, ToggleGroupItem, Bold, Italic, Underline },
setup() {
const formatting = ref(['bold'])
return { formatting }
},
template: `
<ToggleGroup type="multiple" v-model="formatting">
<ToggleGroupItem value="bold" aria-label="Toggle bold">
<Bold class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline class="h-4 w-4" />
</ToggleGroupItem>
</ToggleGroup>
`,
}),
}

Outline​

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-vue-next'
import { ToggleGroup, ToggleGroupItem } from '.'
{
render: () => ({
components: { ToggleGroup, ToggleGroupItem, Bold, Italic, Underline },
setup() {
const formatting = ref([])
return { formatting }
},
template: `
<ToggleGroup type="multiple" variant="outline" v-model="formatting">
<ToggleGroupItem value="bold" aria-label="Toggle bold">
<Bold class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline class="h-4 w-4" />
</ToggleGroupItem>
</ToggleGroup>
`,
}),
}

ToggleGroupItem​

import { ToggleGroupItem } from '@gxp-dev/app-ui'

Repository source

Props​

NameTypeRequired / defaultDescription
variant"default" | "outline" | null | undefined——
size"default" | "sm" | "lg" | null | undefined——
valueAcceptableValueRequiredA string value for the toggle group item. All items within a toggle group should use a unique value.
asChildboolean | undefined—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
asAsTag | Component | undefined—The element or component this component should render as. Can be overwritten by asChild.
disabledboolean | undefined—When true, prevents the user from interacting with the toggle.

Slots​

NameTypeRequired / defaultDescription
default{}——

Examples​

These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.

Single​

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-vue-next'
import { ToggleGroup, ToggleGroupItem } from '.'
{
render: () => ({
components: { ToggleGroup, ToggleGroupItem, AlignLeft, AlignCenter, AlignRight },
setup() {
const alignment = ref('left')
return { alignment }
},
template: `
<ToggleGroup type="single" v-model="alignment">
<ToggleGroupItem value="left" aria-label="Align left">
<AlignLeft class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="center" aria-label="Align center">
<AlignCenter class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="right" aria-label="Align right">
<AlignRight class="h-4 w-4" />
</ToggleGroupItem>
</ToggleGroup>
`,
}),
}

Multiple​

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-vue-next'
import { ToggleGroup, ToggleGroupItem } from '.'
{
render: () => ({
components: { ToggleGroup, ToggleGroupItem, Bold, Italic, Underline },
setup() {
const formatting = ref(['bold'])
return { formatting }
},
template: `
<ToggleGroup type="multiple" v-model="formatting">
<ToggleGroupItem value="bold" aria-label="Toggle bold">
<Bold class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline class="h-4 w-4" />
</ToggleGroupItem>
</ToggleGroup>
`,
}),
}

Outline​

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-vue-next'
import { ToggleGroup, ToggleGroupItem } from '.'
{
render: () => ({
components: { ToggleGroup, ToggleGroupItem, Bold, Italic, Underline },
setup() {
const formatting = ref([])
return { formatting }
},
template: `
<ToggleGroup type="multiple" variant="outline" v-model="formatting">
<ToggleGroupItem value="bold" aria-label="Toggle bold">
<Bold class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="italic" aria-label="Toggle italic">
<Italic class="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem value="underline" aria-label="Toggle underline">
<Underline class="h-4 w-4" />
</ToggleGroupItem>
</ToggleGroup>
`,
}),
}