Separator

A separator element accessible to screen readers.

Vertical

View source
import { Separator } from "@danielfrg/solid-ui/separator"
import styles from "./index.module.css"

export function DemoSeparatorHero() {
  return (
    <div class={styles.container}>
      <a class={styles.link} href="#">
        Home
      </a>
      <a class={styles.link} href="#">
        Pricing
      </a>
      <a class={styles.link} href="#">
        Blog
      </a>
      <a class={styles.link} href="#">
        Support
      </a>

      <Separator orientation="vertical" class={styles.separator} />

      <a class={styles.link} href="#">
        Log in
      </a>
      <a class={styles.link} href="#">
        Sign up
      </a>
    </div>
  )
}
.container {
  display: flex;
  gap: 1rem;
  text-wrap: nowrap;
  align-items: center;
}

.separator {
  border: none;
  background-color: var(--color-gray-300);
}

.separator[data-orientation="vertical"] {
  width: 1px;
  align-self: stretch;
}

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

.horizontalContainer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 20rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-gray-900);
}

.link {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-gray-900);
  text-decoration-color: var(--color-gray-400);
  text-decoration-thickness: 1px;
  text-decoration-line: none;
  text-underline-offset: 2px;
}

:global(.sl-markdown-content) .link {
  color: var(--color-gray-900);
  text-decoration-color: var(--color-gray-400);
}

:global(.sl-markdown-content) .link:visited {
  color: var(--color-gray-900);
}

@media (hover: hover) {
  .link:hover {
    text-decoration-line: underline;
  }
}

.link:focus-visible {
  border-radius: 0.125rem;
  outline: 2px solid var(--color-blue);
  text-decoration-line: none;
}
:root {
  --color-blue: oklch(45% 50% 264deg);
  --color-red: oklch(50% 55% 31deg);
  --color-gray-50: oklch(98% 0.25% 264deg);
  --color-gray-100: oklch(12% 9.5% 264deg / 5%);
  --color-gray-200: oklch(12% 9% 264deg / 7%);
  --color-gray-300: oklch(12% 8.5% 264deg / 17%);
  --color-gray-400: oklch(12% 8% 264deg / 38%);
  --color-gray-500: oklch(12% 7.5% 264deg / 50%);
  --color-gray-600: oklch(12% 7% 264deg / 67%);
  --color-gray-700: oklch(12% 6% 264deg / 77%);
  --color-gray-800: oklch(12% 5% 264deg / 85%);
  --color-gray-900: oklch(12% 5% 264deg / 90%);
  --color-gray-950: oklch(12% 5% 264deg / 95%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-blue: oklch(69% 50% 264deg);
    --color-red: oklch(80% 55% 31deg);
    --color-gray-50: oklch(17% 0.25% 264deg);
    --color-gray-100: oklch(28% 0.75% 264deg / 65%);
    --color-gray-200: oklch(29% 0.75% 264deg / 80%);
    --color-gray-300: oklch(35% 0.75% 264deg / 80%);
    --color-gray-400: oklch(47% 0.875% 264deg / 80%);
    --color-gray-500: oklch(64% 1% 264deg / 80%);
    --color-gray-600: oklch(82% 1% 264deg / 80%);
    --color-gray-700: oklch(92% 1.125% 264deg / 80%);
    --color-gray-800: oklch(93% 0.875% 264deg / 85%);
    --color-gray-900: oklch(95% 0.5% 264deg / 90%);
    --color-gray-950: oklch(94% 0.375% 264deg / 95%);
  }
}

Horizontal

Content above
Content below
View source
import { Separator } from "@danielfrg/solid-ui/separator"
import styles from "./index.module.css"

export function DemoSeparatorHorizontal() {
  return (
    <div class={styles.horizontalContainer}>
      <span>Content above</span>
      <Separator class={styles.separator} />
      <span>Content below</span>
    </div>
  )
}
.container {
  display: flex;
  gap: 1rem;
  text-wrap: nowrap;
  align-items: center;
}

.separator {
  border: none;
  background-color: var(--color-gray-300);
}

.separator[data-orientation="vertical"] {
  width: 1px;
  align-self: stretch;
}

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

.horizontalContainer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 20rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-gray-900);
}

.link {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-gray-900);
  text-decoration-color: var(--color-gray-400);
  text-decoration-thickness: 1px;
  text-decoration-line: none;
  text-underline-offset: 2px;
}

:global(.sl-markdown-content) .link {
  color: var(--color-gray-900);
  text-decoration-color: var(--color-gray-400);
}

:global(.sl-markdown-content) .link:visited {
  color: var(--color-gray-900);
}

@media (hover: hover) {
  .link:hover {
    text-decoration-line: underline;
  }
}

.link:focus-visible {
  border-radius: 0.125rem;
  outline: 2px solid var(--color-blue);
  text-decoration-line: none;
}
:root {
  --color-blue: oklch(45% 50% 264deg);
  --color-red: oklch(50% 55% 31deg);
  --color-gray-50: oklch(98% 0.25% 264deg);
  --color-gray-100: oklch(12% 9.5% 264deg / 5%);
  --color-gray-200: oklch(12% 9% 264deg / 7%);
  --color-gray-300: oklch(12% 8.5% 264deg / 17%);
  --color-gray-400: oklch(12% 8% 264deg / 38%);
  --color-gray-500: oklch(12% 7.5% 264deg / 50%);
  --color-gray-600: oklch(12% 7% 264deg / 67%);
  --color-gray-700: oklch(12% 6% 264deg / 77%);
  --color-gray-800: oklch(12% 5% 264deg / 85%);
  --color-gray-900: oklch(12% 5% 264deg / 90%);
  --color-gray-950: oklch(12% 5% 264deg / 95%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-blue: oklch(69% 50% 264deg);
    --color-red: oklch(80% 55% 31deg);
    --color-gray-50: oklch(17% 0.25% 264deg);
    --color-gray-100: oklch(28% 0.75% 264deg / 65%);
    --color-gray-200: oklch(29% 0.75% 264deg / 80%);
    --color-gray-300: oklch(35% 0.75% 264deg / 80%);
    --color-gray-400: oklch(47% 0.875% 264deg / 80%);
    --color-gray-500: oklch(64% 1% 264deg / 80%);
    --color-gray-600: oklch(82% 1% 264deg / 80%);
    --color-gray-700: oklch(92% 1.125% 264deg / 80%);
    --color-gray-800: oklch(93% 0.875% 264deg / 85%);
    --color-gray-900: oklch(95% 0.5% 264deg / 90%);
    --color-gray-950: oklch(94% 0.375% 264deg / 95%);
  }
}