Toggle Group
A set of two-state buttons that can be toggled on or off.
import { component$ } from '@builder.io/qwik';
import { ToggleGroup } from '~/components/ui';
export default component$(() => {
return (
<ToggleGroup.Root>
<ToggleGroup.Item value="left" aria-label="Left aligned">
Left
</ToggleGroup.Item>
<ToggleGroup.Item value="center" aria-label="Center aligned">
Center
</ToggleGroup.Item>
<ToggleGroup.Item value="right" aria-label="Right aligned">
Right
</ToggleGroup.Item>
</ToggleGroup.Root>
);
});
You can choose a multiple selection variant:
import { component$ } from '@builder.io/qwik';
import { ToggleGroup } from '~/components/ui';
export default component$(() => {
return (
<ToggleGroup.Root multiple>
<ToggleGroup.Item value="left" aria-label="Left aligned">
Left
</ToggleGroup.Item>
<ToggleGroup.Item value="center" aria-label="Center aligned">
Center
</ToggleGroup.Item>
<ToggleGroup.Item value="right" aria-label="Right aligned">
Right
</ToggleGroup.Item>
</ToggleGroup.Root>
);
});
And here is the default look for a disabled ToggleGroup.Root
:
import { component$ } from '@builder.io/qwik';
import { ToggleGroup } from '~/components/ui';
export default component$(() => {
return (
<ToggleGroup.Root disabled>
<ToggleGroup.Item value="left" aria-label="Left aligned">
Left
</ToggleGroup.Item>
<ToggleGroup.Item value="center" aria-label="Center aligned">
Center
</ToggleGroup.Item>
<ToggleGroup.Item value="right" aria-label="Right aligned">
Right
</ToggleGroup.Item>
</ToggleGroup.Root>
);
});
To see all features and the API checkout our
Headless component
Installation
Run the following cli command or copy/paste the component code into your project