Tessera UI

Components

Separator

A thin line that divides content, horizontally or vertically.

The preview needs JavaScript. The code is in the Code tab.

Separator-0.tess
<template>
  <div>
    <p>Profile</p>
    <Separator />
    <p>Billing</p>
  </div>
</template>

Installation

npx @pixelscriptio/tessera add Separator
pnpm exec tessera add Separator
yarn tessera add Separator
bunx @pixelscriptio/tessera add Separator
  • Works with Tessera 0.9.0 or newer.
  1. Copy and paste the code into your project

    Put it in system/components.

    system/components/Separator.tess
    <contract>
    {
      "name": "Separator",
      "role": "separator",
      "description": "A thin line that divides content, horizontally or vertically.",
      "since": "0.8.0",
      "parts": ["root"],
      "variants": {
        "orientation": ["horizontal", "vertical"] // first value is the default
      }
    }
    </contract>
    
    <script>
    const { orientation } = props({})
    </script>
    
    <template>
      <div class="root" role="separator" :aria-orientation="orientation"></div>
    </template>
    
    <style>
    .root {
      flex: none;
      align-self: stretch;
      background: $color.border.default;
    
      &[data-orientation='horizontal'] {
        height: 1px;
        width: 100%;
      }
    
      &[data-orientation='vertical'] {
        width: 1px;
        min-height: $space.4;
      }
    }
    </style>
    
  2. Check your design tokens

    Your design system needs these. tessera add reports the ones that are missing; by hand, run npx @pixelscriptio/tessera check.

    color.border.default space.4

Usage

Using Separator

A thin line between groups of content.

  • Horizontal by default; set orientation="vertical" between items in a row. The vertical one stretches to the height of the row it is in.
  • It is announced as a separator with its orientation. For a gap that has no meaning, use spacing instead.

The preview needs JavaScript. The code is in the Code tab.

Separator-0.tess
<template>
  <div>
    <p>Profile</p>
    <Separator />
    <p>Billing</p>
  </div>
</template>

API reference

Variants

VariantValues
orientationhorizontal default vertical

Anatomy

Roleseparator
Partsroot
Since0.8.0

Design tokens it uses

Your design system needs these. tessera add checks that it has them, and can add the ones it lacks.

color.border.default space.4

Checksum

bf39ed95c03c03ee858b13a00a569b3700954692d26e7e5017754736c941e16b