Skip to content

KSelectableButtonGroup

示例

Single Select

Choose a color

Selected:

Multi Select (teal variant)

Choose colors

Selected:

A responsive grid of selectable buttons supporting single or multiple selection, with optional collapsible behavior.

Props

NameTypeDefaultDescription
titlestringGroup title displayed above the buttons.
itemsSelectableButtonItem[]— (required)Array of items with value, label, optional icon, and optional tagCount.
modelValuestring | number | Array<string | number>Currently selected value(s).
multiplebooleanfalseWhether multiple items can be selected.
collapsiblebooleanfalseWhether to collapse the grid with a "Show more" toggle.
collapseHeightnumber160Maximum height in pixels when collapsed.
loadingbooleanfalseWhether to show a loading skeleton instead of buttons.
variant'violet' | 'teal' | 'amber' | 'rose' | 'green''violet'Color variant for active states and badges.
classstringAdditional CSS classes for the root element.

SelectableButtonItem: { value: string \| number; label: string; icon?: string; tagCount?: number }

Emits

NameParametersDescription
update:modelValuestring | number | Array<string | number>Emitted when the selection changes.

Slots

NameDescription
This component does not provide slots.

Basic Usage

vue
<script setup>
import { ref } from 'vue'
import { KSelectableButtonGroup } from '@kK-2004/ui-component'

const selected = ref('')
const items = [
  { value: 'vue', label: 'Vue', icon: '🟢' },
  { value: 'react', label: 'React', icon: '🔵' },
  { value: 'svelte', label: 'Svelte', icon: '🟠' },
]
</script>

<template>
  <KSelectableButtonGroup
    v-model="selected"
    title="Framework"
    :items="items"
    variant="violet"
  />
</template>