--- name: oat-css description: Our preferred CSS framework — ultra-lightweight, semantic HTML UI library (~8KB). Style web UIs with semantic HTML and minimal classes. Override with app-level SCSS only when necessary. license: MIT authors: "SpinSpire Team" --- # Oat CSS Oat is an ultra-lightweight (~8KB min+gz), zero-dependency, semantic HTML/CSS/JS UI library by [Kailash Nadh](https://nadh.in) (5k+ stars on [GitHub](https://github.com/knadh/oat)). It styles native HTML elements out of the box — no classes needed for basic UIs. Dynamic components use WebComponents with minimal JS. **Philosophy:** Semantic tags and attributes are styled contextually without classes, forcing best practices and reducing markup class pollution. Only reach for custom CSS when Oat's defaults don't cover your use case. ## Installation ### npm (SvelteKit, Vite, etc.) ``` bun add @knadh/oat ``` In your app entry or root SCSS: ```scss @import '@knadh/oat/oat.min.css'; ``` Import the JS for dynamic components (dialog, dropdown, tabs, toast, tooltip, sidebar): ```ts import '@knadh/oat/oat.min.js'; ``` Or selectively import individual files from `@knadh/oat/css/` and `@knadh/oat/js/`. ### CDN ```html ``` ## Core Principle **Use semantic HTML. Oat styles elements based on their tag and ARIA attributes, not CSS classes.** ```html

Title

Content

Title

Content

``` ## When to Add Custom CSS/SCSS Only override when: 1. **Brand colors** — redefine CSS variables in `:root` (see Theming below) 2. **Layout** — use Oat's `.hstack`, `.vstack`, `.container`/`.row`/`.col-*` grid, or add your own 3. **Complex compositions** — recipes like stats cards, split buttons, form cards 4. **Custom animations or interactions** — Oat doesn't ship opinionated transitions beyond the basics Every Oat component below is purely semantic HTML. No custom CSS needed. ## Components ### Typography ```html

Heading 1

Heading 2

Heading 3

Paragraph with bold, italic, and a link.

code block
Blockquote

  1. Ordered item
``` ### Button ` Link as button ``` Button group: ```html
  • ``` ### Card ```html

    Card Title

    Description

    Content here.

    ``` ### Alert Use `role="alert"` with optional `data-variant` (`success`, `warning`, `error`). ```html
    Success! Your changes have been saved.
    Warning! Please review before continuing.
    Info This is a default alert.
    Error! Something went wrong.
    ``` ### Form Wrap inputs in `