danielfrg/solid-ui

Unstyled UI components for SolidJS.

The objective is to have a solid Base-UI like implementation in SolidJS.

Mostly forked from Kobalte and others adapted from Base UI.

Quick start

Install:

npm install @danielfrg/solid-ui

Import the components you need:

import { Button } from "@danielfrg/solid-ui/button"

Use and style the components in your app:

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

export function DemoButtonHero() {
  return (
    <div class="demo-row">
      <Button class={styles.button}>Default</Button>
      <Button class={styles.button} disabled>
        Disabled
      </Button>
    </div>
  )
}
.button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 0.875rem;
  outline: 0;
  border: 1px solid var(--color-gray-200);
  border-radius: 0.375rem;
  background-color: var(--color-gray-50);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5rem;
  color: var(--color-gray-900);
  user-select: none;
}

@media (hover: hover) {
  .button:hover:not([data-disabled]) {
    background-color: var(--color-gray-100);
  }
}

.button:active:not([data-disabled]) {
  background-color: var(--color-gray-200);
  box-shadow: inset 0 1px 3px var(--color-gray-200);
  border-top-color: var(--color-gray-300);
}

.button:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: -1px;
}

.button[data-disabled] {
  color: var(--color-gray-500);
  background-color: var(--color-gray-100);
  border-color: var(--color-gray-200);
  cursor: not-allowed;
  box-shadow: 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%);
  }
}

Themes

An implementation of shadcn style components (with variants and so on) based on their Nova styles in @danielfrg/solid-ui-nova

If you want your own components you can fork the styled package and customize them. It’s very easy to create your own styles with LLMs by forking the nova example theme.