Separator

A horizontal or vertical dividing line.

Install

If this is the first component in the project, set up once. This writes ermine.json and copies the theme stylesheet. The installation guide covers Vue, Nuxt and Astro.

npx ermineui init
pnpm dlx ermineui init
yarn dlx ermineui init
bunx ermineui init

Then add the component:

npx ermineui add separator
pnpm dlx ermineui add separator
yarn dlx ermineui add separator
bunx ermineui add separator

That copies 2 files into src/components/ui/separator/. Files you already have are kept.

Use

import { Separator } from '@/components/ui/separator'
<script setup lang="ts">
import { Separator } from '@/components/ui/separator'
</script>

<template>
  <Separator />
</template>

In Nuxt, with the auto-import setting, the tags work in templates without the import. In Astro, use it inside a Vue island. The props are documented in the source below, on each one.

What gets copied

FileWhere it goes
Separator.vuesrc/components/ui/separator/Separator.vue
index.tssrc/components/ui/separator/index.ts

The folders are the suggested ones. ermine.json says where yours are.

Source

This is exactly what the command copies. To install by hand, create each file below and the helpers listed above.

Separator.vue 39 lines
<script setup lang="ts">
withDefaults(
  defineProps<{
    orientation?: 'horizontal' | 'vertical'
    /** Purely visual (default). Set to false when the line separates content for screen readers too. */
    decorative?: boolean
  }>(),
  { orientation: 'horizontal', decorative: true },
)
</script>

<template>
  <div
    class="er-separator"
    :role="decorative ? 'none' : 'separator'"
    :aria-orientation="!decorative && orientation === 'vertical' ? 'vertical' : undefined"
    :data-orientation="orientation"
  />
</template>

<style>
@layer components {
  .er-separator {
    flex-shrink: 0;
    background: var(--er-border);
  }

  .er-separator[data-orientation='horizontal'] {
    width: 100%;
    height: 1px;
  }

  .er-separator[data-orientation='vertical'] {
    align-self: stretch;
    width: 1px;
  }
}
</style>
index.ts 3 lines
/** Separator — a horizontal or vertical dividing line. */
export { default as Separator } from './Separator.vue'