IconButtonGroup
HkIconButtonGroup is the icon-only member of the button-group family: a row of icon buttons that form ONE control. It has three modes that decide what the group means — buttons, an action strip; single, a radio group; multiple, a toggle set — and three visual treatments that are independent of the meaning: track (the default), plain and slider.
- Independent actions that merely share a row are separate HkIconButtons, each with its own frame and spacing. A group is a selector, or a toolbar whose commands belong together.
- For a text version of the same strip see the tabs family; this component is the same grammar without captions.
Import
import { HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
use hikari_components::*; use hikari_components::prelude::*;
Action strip
In the default buttons mode the group holds no selection: every press fires select with the option's key. Each item takes its tooltip from its label, and that label is also the accessible name of the icon-only button — which is why it is required.
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
const actions: HkIconButtonGroupOption[] = [
{ key: "copy", label: "Copy", icon: <HkIcon name="Copy" size={20} /> },
{ key: "rename", label: "Rename", icon: <HkIcon name="Pencil" size={20} /> },
{ key: "star", label: "Favourite", icon: <HkIcon name="Star" size={20} /> },
];
export default () => <HkIconButtonGroup options={actions} aria-label="File actions" />;
rsx! {
IconButtonGroup {
aria_label: Some("File actions".to_string()),
options: vec![
HkIconButtonGroupOption::new("copy", MdiIcon::ContentCopy, "Copy"),
HkIconButtonGroupOption::new("rename", MdiIcon::Pencil, "Rename"),
HkIconButtonGroupOption::new("star", MdiIcon::Star, "Favourite"),
],
}
}
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
const actions: HkIconButtonGroupOption[] = [
{ key: "copy", label: "Copy", icon: <HkIcon name="Copy" size={20} /> },
{ key: "rename", label: "Rename", icon: <HkIcon name="Pencil" size={20} /> },
{ key: "star", label: "Favourite", icon: <HkIcon name="Star" size={20} /> },
];
export default () => <HkIconButtonGroup options={actions} aria-label="File actions" />;rsx! {
IconButtonGroup {
aria_label: Some("File actions".to_string()),
options: vec![
HkIconButtonGroupOption::new("copy", MdiIcon::ContentCopy, "Copy"),
HkIconButtonGroupOption::new("rename", MdiIcon::Pencil, "Rename"),
HkIconButtonGroupOption::new("star", MdiIcon::Star, "Favourite"),
],
}
}Single selection
With mode="single" the group is a radio group: one active key, v-model carries it, and pressing the already active item does nothing. The slider variant puts a sliding thumb behind the active item; it exists only in this mode.
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
const views: HkIconButtonGroupOption[] = [
{ key: "table", label: "Table", icon: <HkIcon name="Table" size={20} /> },
{ key: "board", label: "Board", icon: <HkIcon name="Kanban" size={20} /> },
{ key: "timeline", label: "Timeline", icon: <HkIcon name="LayoutDashboard" size={20} /> },
];
export default () => (
<HkIconButtonGroup options={views} mode="single" variant="slider" modelValue="table" aria-label="View" />
);
rsx! {
IconButtonGroup {
aria_label: Some("View".to_string()),
mode: IconButtonGroupMode::Single,
variant: IconButtonGroupVariant::Slider,
value: Some("table".to_string()),
options: vec![
HkIconButtonGroupOption::new("table", MdiIcon::Table, "Table"),
HkIconButtonGroupOption::new("board", MdiIcon::ViewDashboard, "Board"),
HkIconButtonGroupOption::new("timeline", MdiIcon::ViewColumn, "Timeline"),
],
}
}
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
const views: HkIconButtonGroupOption[] = [
{ key: "table", label: "Table", icon: <HkIcon name="Table" size={20} /> },
{ key: "board", label: "Board", icon: <HkIcon name="Kanban" size={20} /> },
{ key: "timeline", label: "Timeline", icon: <HkIcon name="LayoutDashboard" size={20} /> },
];
export default () => (
<HkIconButtonGroup options={views} mode="single" variant="slider" modelValue="table" aria-label="View" />
);rsx! {
IconButtonGroup {
aria_label: Some("View".to_string()),
mode: IconButtonGroupMode::Single,
variant: IconButtonGroupVariant::Slider,
value: Some("table".to_string()),
options: vec![
HkIconButtonGroupOption::new("table", MdiIcon::Table, "Table"),
HkIconButtonGroupOption::new("board", MdiIcon::ViewDashboard, "Board"),
HkIconButtonGroupOption::new("timeline", MdiIcon::ViewColumn, "Timeline"),
],
}
}Multiple selection
With mode="multiple" every item toggles independently and v-model is the array of active keys; each item publishes aria-pressed. Here two of the three are active.
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
const marks: HkIconButtonGroupOption[] = [
{ key: "star", label: "Favourite", icon: <HkIcon name="Star" size={20} /> },
{ key: "watch", label: "Watch", icon: <HkIcon name="Bell" size={20} /> },
{ key: "tag", label: "Label", icon: <HkIcon name="Tag" size={20} /> },
];
export default () => (
<HkIconButtonGroup options={marks} mode="multiple" modelValue={["star", "watch"]} aria-label="Marks" />
);
rsx! {
IconButtonGroup {
aria_label: Some("Marks".to_string()),
mode: IconButtonGroupMode::Multiple,
values: vec!["star".to_string(), "watch".to_string()],
options: vec![
HkIconButtonGroupOption::new("star", MdiIcon::Star, "Favourite"),
HkIconButtonGroupOption::new("watch", MdiIcon::Bell, "Watch"),
HkIconButtonGroupOption::new("tag", MdiIcon::Tag, "Label"),
],
}
}
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
const marks: HkIconButtonGroupOption[] = [
{ key: "star", label: "Favourite", icon: <HkIcon name="Star" size={20} /> },
{ key: "watch", label: "Watch", icon: <HkIcon name="Bell" size={20} /> },
{ key: "tag", label: "Label", icon: <HkIcon name="Tag" size={20} /> },
];
export default () => (
<HkIconButtonGroup options={marks} mode="multiple" modelValue={["star", "watch"]} aria-label="Marks" />
);rsx! {
IconButtonGroup {
aria_label: Some("Marks".to_string()),
mode: IconButtonGroupMode::Multiple,
values: vec!["star".to_string(), "watch".to_string()],
options: vec![
HkIconButtonGroupOption::new("star", MdiIcon::Star, "Favourite"),
HkIconButtonGroupOption::new("watch", MdiIcon::Bell, "Watch"),
HkIconButtonGroupOption::new("tag", MdiIcon::Tag, "Label"),
],
}
}Treatments, sizes and disabled items
track is the framed inset strip, plain drops the frame and lets each item tint its own active state, slider adds the thumb. The three sizes — sm, md (the default), lg — are one step taller than the icon button's. A single option can be disabled while its neighbours stay live; the group's own disabled prop locks every item.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const column: CSSProperties = { display: "flex", flexDirection: "column", gap: "16px", alignItems: "flex-start" };
const views: HkIconButtonGroupOption[] = [
{ key: "table", label: "Table", icon: <HkIcon name="Table" size={20} /> },
{ key: "board", label: "Board", icon: <HkIcon name="Kanban" size={20} /> },
{
key: "timeline",
label: "Timeline",
icon: <HkIcon name="LayoutDashboard" size={20} />,
disabled: true,
},
];
export default () => (
<div style={column}>
<HkIconButtonGroup options={views} mode="single" variant="plain" modelValue="table" aria-label="View, plain" />
<HkIconButtonGroup options={views} mode="single" variant="track" modelValue="board" aria-label="View, track" />
<HkIconButtonGroup options={views} mode="single" variant="track" size="lg" modelValue="table" aria-label="View, large" />
<HkIconButtonGroup options={views} mode="single" disabled aria-label="View, locked" />
</div>
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
let views = || {
vec![
HkIconButtonGroupOption::new("table", MdiIcon::Table, "Table"),
HkIconButtonGroupOption::new("board", MdiIcon::ViewDashboard, "Board"),
HkIconButtonGroupOption {
key: "timeline".to_string(),
icon: MdiIcon::ViewColumn,
label: "Timeline".to_string(),
tooltip: None,
disabled: true,
},
]
};
rsx! {
div { style: "display:flex;flex-direction:column;gap:16px;align-items:flex-start",
IconButtonGroup {
aria_label: Some("View, plain".to_string()),
mode: IconButtonGroupMode::Single,
variant: IconButtonGroupVariant::Plain,
value: Some("table".to_string()),
options: views(),
}
IconButtonGroup {
aria_label: Some("View, track".to_string()),
mode: IconButtonGroupMode::Single,
value: Some("board".to_string()),
options: views(),
}
IconButtonGroup {
aria_label: Some("View, large".to_string()),
mode: IconButtonGroupMode::Single,
size: IconButtonGroupSize::Lg,
value: Some("table".to_string()),
options: views(),
}
IconButtonGroup {
aria_label: Some("View, locked".to_string()),
mode: IconButtonGroupMode::Single,
disabled: true,
options: views(),
}
}
}
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const column: CSSProperties = { display: "flex", flexDirection: "column", gap: "16px", alignItems: "flex-start" };
const views: HkIconButtonGroupOption[] = [
{ key: "table", label: "Table", icon: <HkIcon name="Table" size={20} /> },
{ key: "board", label: "Board", icon: <HkIcon name="Kanban" size={20} /> },
{
key: "timeline",
label: "Timeline",
icon: <HkIcon name="LayoutDashboard" size={20} />,
disabled: true,
},
];
export default () => (
<div style={column}>
<HkIconButtonGroup options={views} mode="single" variant="plain" modelValue="table" aria-label="View, plain" />
<HkIconButtonGroup options={views} mode="single" variant="track" modelValue="board" aria-label="View, track" />
<HkIconButtonGroup options={views} mode="single" variant="track" size="lg" modelValue="table" aria-label="View, large" />
<HkIconButtonGroup options={views} mode="single" disabled aria-label="View, locked" />
</div>
);let views = || {
vec![
HkIconButtonGroupOption::new("table", MdiIcon::Table, "Table"),
HkIconButtonGroupOption::new("board", MdiIcon::ViewDashboard, "Board"),
HkIconButtonGroupOption {
key: "timeline".to_string(),
icon: MdiIcon::ViewColumn,
label: "Timeline".to_string(),
tooltip: None,
disabled: true,
},
]
};
rsx! {
div { style: "display:flex;flex-direction:column;gap:16px;align-items:flex-start",
IconButtonGroup {
aria_label: Some("View, plain".to_string()),
mode: IconButtonGroupMode::Single,
variant: IconButtonGroupVariant::Plain,
value: Some("table".to_string()),
options: views(),
}
IconButtonGroup {
aria_label: Some("View, track".to_string()),
mode: IconButtonGroupMode::Single,
value: Some("board".to_string()),
options: views(),
}
IconButtonGroup {
aria_label: Some("View, large".to_string()),
mode: IconButtonGroupMode::Single,
size: IconButtonGroupSize::Lg,
value: Some("table".to_string()),
options: views(),
}
IconButtonGroup {
aria_label: Some("View, locked".to_string()),
mode: IconButtonGroupMode::Single,
disabled: true,
options: views(),
}
}
}Interaction
update:modelValue reports the next value — a string in single mode, an array in multiple mode — and select fires right after it with the key that was pressed. The group is controlled: the host owns the value. The example switches the view; the Rust mirror is controlled in the same way (value / values plus on_value_change), so it has no separate snapshot here.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { ref } from "vue";
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const views: HkIconButtonGroupOption[] = [
{ key: "table", label: "Table", icon: <HkIcon name="Table" size={20} /> },
{ key: "board", label: "Board", icon: <HkIcon name="Kanban" size={20} /> },
{ key: "timeline", label: "Timeline", icon: <HkIcon name="LayoutDashboard" size={20} /> },
];
const row: CSSProperties = { display: "flex", gap: "16px", alignItems: "center" };
export default () => {
const view = ref("table");
return (
<div style={row}>
<HkIconButtonGroup
options={views}
mode="single"
variant="slider"
modelValue={view.value}
onUpdate:modelValue={(value) => {
view.value = String(value);
}}
aria-label="View"
/>
<span>Current view: {view.value}</span>
</div>
);
};
import { ref } from "vue";
import { HkIcon, HkIconButtonGroup, type HkIconButtonGroupOption } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const views: HkIconButtonGroupOption[] = [
{ key: "table", label: "Table", icon: <HkIcon name="Table" size={20} /> },
{ key: "board", label: "Board", icon: <HkIcon name="Kanban" size={20} /> },
{ key: "timeline", label: "Timeline", icon: <HkIcon name="LayoutDashboard" size={20} /> },
];
const row: CSSProperties = { display: "flex", gap: "16px", alignItems: "center" };
export default () => {
const view = ref("table");
return (
<div style={row}>
<HkIconButtonGroup
options={views}
mode="single"
variant="slider"
modelValue={view.value}
onUpdate:modelValue={(value) => {
view.value = String(value);
}}
aria-label="View"
/>
<span>Current view: {view.value}</span>
</div>
);
};
API
Vue
Props
Emits
Rust
Props — IconButtonGroup
Accessibility
- Every option needs a label: it is the accessible name of an icon-only button and the default text of its tooltip. An empty tooltip on an option suppresses the tooltip, never the name.
- single mode publishes role="radiogroup" and aria-checked on the items; multiple publishes aria-pressed.
- All items are tabbable in every mode — the keyboard reaches each one, but the group does not implement a roving tabindex.
Related components
- HkIconButton — the single icon button the group is built of.
- Button — the text button of the same family.
- HkFab — a floating button whose speed dial is a vertical strip of labelled actions.