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 initpnpm dlx ermineui inityarn dlx ermineui initbunx ermineui initThen add the component:
npx ermineui add separatorpnpm dlx ermineui add separatoryarn dlx ermineui add separatorbunx ermineui add separatorThat 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
| File | Where it goes |
|---|---|
Separator.vue | src/components/ui/separator/Separator.vue |
index.ts | src/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'