Components › Components

On this page

Separator

A line between content, horizontal or vertical.

Above the line

Docs Source
Issues

Usage #

tscl
@import uiSeparator from './separator.tscl'

<div class="demo">
  <p>Above the line</p>
  <uiSeparator />
  <div class="row">
    <span>Docs</span>
    <uiSeparator orientation="vertical" />
    <span>Source</span>
    <uiSeparator orientation="vertical" decorative />
    <span>Issues</span>
  </div>
</div>

<style scoped>
  :scope {
    display: grid;
    gap: 12px;
    padding: 24px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-bg);
    color: var(--ui-fg);
  }
  .row {
    display: flex;
    gap: 12px;
    align-items: center;
    height: 20px;
  }
  p {
    margin: 0;
  }
</style>

Source #

Copy it into your components folder (next to the others) as separator.tscl.

tscl
{{-- Separator: a line between content. [decorative]="true" hides it from assistive technology. --}}
@input orientation: 'horizontal' | 'vertical' = 'horizontal'
@input decorative: boolean = false

<div
  [role]="decorative ? 'none' : 'separator'"
  [aria-orientation]="decorative ? null : orientation"
  data-part="separator"
  [data-orientation]="orientation"
></div>

<style scoped>
  @layer theme, base, components, utilities;
  @layer components {
    :where(:scope) {
      flex-shrink: 0;
      background: var(--ui-border);
    }
    :where(:scope[data-orientation='horizontal']) {
      height: 1px;
      width: 100%;
    }
    :where(:scope[data-orientation='vertical']) {
      width: 1px;
      align-self: stretch;
    }
  }
</style>

Styling #

Needs #