Skip to content

3lvia/designsystem / skills/elvia-design-system

elvia-design-system

Verified

Reference for UI components and patterns in Elvia's design system ("Elvis"). Covers component- and pattern-specific guidelines for sizing, color tokens for custom UI, types, ordering, labeling, accessibility attributes, CSS setup, and web-component registration. Use when building, reviewing, or fixing UI in an Elvia frontend, even if the request doesn't name Elvia or the CSS classes explicitly (e.g. "add a save button", "make this icon bigger", "add a tooltip").

FileKindSize
README.mdmarkdown726 B
SKILL.mdskill md10.4 KB
references/accordion.mdmarkdown5.9 KB
references/alert.mdmarkdown4.3 KB
references/app-bridge.mdmarkdown3.3 KB
references/autocomplete.mdmarkdown5.5 KB
references/badge.mdmarkdown2.3 KB
references/box.mdmarkdown2.0 KB
references/breadcrumb.mdmarkdown2.9 KB
references/button.mdmarkdown6.0 KB
references/card.mdmarkdown5.6 KB
references/carousel.mdmarkdown4.4 KB
references/checkbox.mdmarkdown4.7 KB
references/chip.mdmarkdown4.1 KB
references/color-tokens.mdmarkdown5.6 KB
references/content-loader.mdmarkdown2.0 KB
references/context-menu.mdmarkdown6.6 KB
references/data-formats.mdmarkdown2.1 KB
references/datepicker-range.mdmarkdown5.4 KB
references/datepicker.mdmarkdown6.0 KB
references/divider.mdmarkdown2.4 KB
references/drag-and-drop.mdmarkdown2.0 KB
references/dropdown.mdmarkdown6.7 KB
references/empty-state.mdmarkdown3.0 KB
references/file-upload.mdmarkdown2.6 KB
references/form-field.mdmarkdown2.7 KB
references/header.mdmarkdown5.8 KB
references/icon.mdmarkdown5.0 KB
references/illustrations.mdmarkdown1.4 KB
references/input.mdmarkdown2.5 KB
references/installation.mdmarkdown2.1 KB
references/link.mdmarkdown3.3 KB
references/list.mdmarkdown2.0 KB
references/modal.mdmarkdown6.1 KB
references/pagination.mdmarkdown4.0 KB
references/popover.mdmarkdown5.3 KB
references/progress-linear.mdmarkdown3.1 KB
references/radio-button.mdmarkdown2.6 KB
references/radio-filter.mdmarkdown2.8 KB
references/search-pattern.mdmarkdown2.7 KB
references/segmented-control.mdmarkdown3.9 KB
references/shadows.mdmarkdown1.3 KB
references/slider.mdmarkdown3.6 KB
references/stepper.mdmarkdown4.7 KB
references/table.mdmarkdown8.4 KB
references/tabs.mdmarkdown3.8 KB
references/tag.mdmarkdown5.0 KB
references/thumbnail.mdmarkdown1.9 KB
references/timepicker.mdmarkdown5.1 KB
references/toast.mdmarkdown3.4 KB
references/toggle.mdmarkdown2.1 KB
references/tooltip.mdmarkdown4.1 KB
references/typography.mdmarkdown3.3 KB
references/utility-classes.mdmarkdown3.9 KB
references/web-components.mdmarkdown2.1 KB

references/segmented-control.md

View on GitHub
- [Segmented Control (`<elvia-segmented-control>`)](#segmented-control-elvia-segmented-control)
  - [Reference](#reference)
  - [Installation](#installation)
  - [Use](#use)
  - [Attributes](#attributes)
    - [items](#items)
    - [value](#value)
    - [type](#type)
    - [size](#size)
    - [valueOnChange](#valueonchange)
  - [Guidelines](#guidelines)
    - [When to use](#when-to-use)
    - [When not to use](#when-not-to-use)
  - [Accessibility](#accessibility)
  - [Examples](#examples)

# Segmented Control (`<elvia-segmented-control>`)

## Reference

https://design.elvia.io/components/segmented-control

`<elvia-segmented-control>` is a web component.

## Installation

This web component requires the `@elvia/elvis-segmented-control` package. If it is not installed, follow the
[Installation reference](./installation.md).

## Use

```html
<elvia-segmented-control
  items='[{"label":"Uke"},{"label":"Måned"},{"label":"År"}]'
  value="0"
></elvia-segmented-control>
```

It emits the selected index. Listen for `valueOnChange` and show the matching view.

For updates to `value` or `items` after initialization, follow the shared
[attribute and property guidance](./web-components.md#attributes-and-properties).

## Attributes

### items

Required. Pass an array of text items or icon items.

- Text items use `label`.
- Icon items use `icon`, `iconSelected`, and `ariaLabel`. `tooltip` is optional.
- Use `icon` for the unselected state and `iconSelected` for the selected state.
- Icon values are HTML strings. See [Arrays and objects](./web-components.md#arrays-and-objects) for how to
  pass the value. See [Icons](./icon.md) for `<e-icon>` registration.

### value

The zero-based index of the selected item. Defaults to `0`.

### type

Set to `text` or `icon`. Defaults to `text`.

### size

Set to `small`, `medium`, or `large`. Defaults to `medium`. The component sets `<e-icon>` to 16px for small
and medium sizes, and 24px for large.

### valueOnChange

Emits when the user selects an item. The event value is the selected item index. See
[Events](./web-components.md#events).

## Guidelines

### When to use

- Use segmented control to switch between closely related subviews.
- Use segmented control to switch between a small set of views with short labels.
- As much as possible, use text with a similar size in each segment.
- Use nouns or noun phrases for segment labels.

### When not to use

- Do not use it for more than three options or long labels. Use a [Dropdown](./dropdown.md) instead.

## Accessibility

- Text items use their `label` as the radio label.
- Every icon item MUST set `ariaLabel`.
- Users can move between items with the Left/Right or Up/Down Arrow keys.

## Examples

**Input:** Switch between three time periods and show the selected view.

**Output:**

```html
<elvia-segmented-control
  id="control"
  items='[{"label":"Uke"},{"label":"Måned"},{"label":"År"}]'
></elvia-segmented-control>

<div id="views">
  <section>Uke innhold</section>
  <section hidden>Måned innhold</section>
  <section hidden>År innhold</section>
</div>
```

```js
const control = document.querySelector('#control');
const views = document.querySelectorAll('#views > section');

control.addEventListener('valueOnChange', (event) => {
  views.forEach((view, index) => {
    view.hidden = index !== event.detail.value;
  });
});
```

Use your frameworks control flow to show and hide the corresponding views.

**Input:** Use icon options to switch between image and list views.

**Output:**

```html
<elvia-segmented-control id="control" type="icon"></elvia-segmented-control>
```

```js
const control = document.querySelector('#control');

control.items = [
  {
    ariaLabel: 'Bildevisning',
    icon: '<e-icon name="thumbnail"></e-icon>',
    iconSelected: '<e-icon name="thumbnailColor"></e-icon>',
    tooltip: 'Bilder',
  },
  {
    ariaLabel: 'Listevisning',
    icon: '<e-icon name="list"></e-icon>',
    iconSelected: '<e-icon name="listColor"></e-icon>',
    tooltip: 'Liste',
  },
];
```
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall