# UnderlineTabs

A row of tabs with a sliding accent underline.

## Active tab

`active` names the current tab and `onChange` reports a click; the underline slides to it.

## Trailing content

The `trailing` snippet puts an action at the row's end.

## Examples

```svelte
<script lang="ts">
  import Button from '@qualia-studios/design-ui/components/Button.svelte';
  import UnderlineTabs from '@qualia-studios/design-ui/components/UnderlineTabs.svelte';

  const tabs = [
    { key: 'overview', label: 'overview' },
    { key: 'outliers', label: 'outliers' },
    { key: 'training', label: 'training' },
  ];
  let active = $state('overview');
</script>
```

### Example 1: Three tabs

Active: overview

```svelte
<div class="fill">
  <UnderlineTabs {tabs} {active} onChange={(k) => (active = k)} />
</div>
```

### Example 2: A trailing action

```svelte
<div class="fill">
  <UnderlineTabs {tabs} {active} onChange={(k) => (active = k)}>
    {#snippet trailing()}
      <Button size="small" variant="text">save</Button>
    {/snippet}
  </UnderlineTabs>
</div>
```

---

From the Qualia design guide: https://q-core-3b2732.gitlab.io/components/underlinetabs. Every page as markdown: https://q-core-3b2732.gitlab.io/llms.txt
