### README (README.md)
# Oat UI
> Semantic, minimal, zero dependencies. ~10KB CSS and JS.
Oat is an ultra-lightweight HTML + CSS, semantic UI component library with zero dependencies. No framework, build, or dev complexity. Just include the tiny CSS and JS files and you are good to go building decent looking web applications with most commonly needed components and elements.
Semantic tags and attributes are styled contextually out of the box without classes, forcing best practices, and reducing markup class pollution. A few dynamic components are WebComponents and use minimal JavaScript.
I wrote this to use in my own projects after getting sick of the ridiculous bloat, dependencies, and rug-pulls in Javascript UI/component libraries.
See live demo and docs at [**oat.ink**](https://oat.ink)
**IMPORTANT:** The lib is currently sub v1 and is likely to have breaking changes until it hits v1.
-------------
---
### Package.Json (package.json)
{
"name": "@knadh/oat",
"version": "version-0.0.0",
"license": "MIT",
"author": "Kailash Nadh",
"homepage": "https://oat.ink",
"description": " Ultra-lightweight, zero dependency, semantic HTML/CSS/JS UI library",
"repository": {
"type": "git",
"url": "git+https://github.com/knadh/oat.git"
},
"keywords": ["ui", "components", "component-library"],
"files": [
"oat.min.css",
"oat.min.js",
"css",
"js"
],
"main": "oat.min.js",
"style": "oat.min.css",
"unpkg": "oat.min.js",
"jsdelivr": "oat.min.js"
}
---
### Content/Customizing (docs/content/customizing.md)
+++
title = "Customizing"
description = "Customize and theme Oat by overriding CSS variables"
+++
Pretty much all properties of Oat are defined as CSS variables that can be overridden. See [theme.css](https://github.com/knadh/oat/blob/master/src/css/01-theme.css) to see all variables. To override, redefine them in a CSS file in your project and include it after the lib's CSS files.
## Picking and choosing
While it is quite okay to bundle all of Oat given how tiny it is, it is possible to include components selectively.
##### Must include
- `00-base.css`
- `01-theme.css`
- `base.js`
- `your files after this`
-------
## Theming
The following color variables from theme.css control the theme (colour profile). Override them to create your own theme.
```css
:root {
/* Page background */
--background: rgb(255 255 255);
/* Primary text color */
--foreground: rgb(9 9 11);
/* Card background */
--card: rgb(255 255 255);
/* Card text color */
--card-foreground: rgb(9 9 11);
/* Primary buttons and links */
--primary: rgb(87 71 71);
/* Text color on primary buttons */
--primary-foreground: rgb(250 250 250);
/* Secondary button background */
--secondary: rgb(244 244 245);
/* Text colour on secondary buttons */
--secondary-foreground: rgb(87 71 71);
/* Muted (lighter) background */
--muted: rgb(244 244 245);
/* Muted (lighter) text colour */
--muted-foreground: rgb(113 113 122);
/* Subtler than muted background */
--faint: rgb(250 250 250);
/* Subtler than muted text color */
--faint-foreground: rgb(161 161 170);
/* Accent background */
--accent: rgb(244 244 245);
/* Error/danger color */
--danger: rgb(211 47 47);
/* Text color on danger background */
--danger-foreground: rgb(250 250 250);
/* Success color */
--success: rgb(0 128 50);
/* Text colour on success background */
--success-foreground: rgb(250 250 250);
/* Warning color */
--warning: rgb(166 91 0);
/* Text colour on warning background */
--warning-foreground: rgb(9 9 11);
/* Border color (boxes) */
--border: rgb(212 212 216);
/* Input borders */
--input: rgb(212 212 216);
/* Focus ring color */
--ring: rgb(87 71 71);
}
```
After these, include CSS and JS files the respective components.
## Example themes
### Default Oat brown
```css
--background: #fff;
--foreground: #09090b;
--card: #fff;
--card-foreground: #09090b;
--primary: #574747;
--primary-foreground: #fafafa;
--secondary: #f4f4f5;
--secondary-foreground: #574747;
--muted: #f4f4f5;
--muted-foreground: #71717a;
--faint: #fafafa;
--faint-foreground: #a1a1aa;
--accent: #f4f4f5;
--danger: #d32f2f;
--danger-foreground: #fafafa;
--success: #008032;
--success-foreground: #fafafa;
--warning: #a65b00;
--warning-foreground: #09090b;
--border: #d4d4d8;
--input: #d4d4d8;
--ring: #574747;
```
---------------
## Dark mode
Dark mode is applied automatically via `light-dark()` and `color-scheme: light dark`, following the OS system preference. To customize the dark theme, redefine the theme variables scoped inside a `[data-theme="dark"]` selector in your own CSS. To forcibly set a theme, `document.body.style.colorScheme = 'dark|light'`.
---
### Content/Demo (docs/content/demo.md)
+++
title = "Oat kitchensink dashboard demo"
template = "demo.html"
+++
---
### Content/Extensions (docs/content/extensions.md)
+++
title = "Extensions"
description = "Community extensions for Oat UI"
+++
Third-party extensions that work with Oat.
- **[oat-chips](https://github.com/someshkar/oat-chips)**: Chip/tag component with dismissible filters, colors, and toggle selection. ~1KB gzipped ([Demo](https://oat-chips.somesh.dev)).
- **[oat-animate](https://github.com/dharmeshgurnani/oat-animate)**: Lightweight animation extension for Oat with declarative `ot-animate` triggers (`on-load`, `hover`, `in-view`) and reduced-motion support. ~1kb gzipped ([Demo](https://oat-animate.dharmeshgurnani.com)).
- **[oat-table](https://github.com/MADEVAL/Oat-Table)**: Semantic table enhancement for Oat UI. Sort, filter, and select rows without turning tables into a framework widget. ([Demo](https://demo.globus.studio/oat-table/)).
- **[oat-upload](https://github.com/MADEVAL/Oat-Upload)**: Dropzone, file previews, validation, removal, and progress for native `` in Oat UI. ([Demo](https://demo.globus.studio/oat-upload/)).
-------
[Open a PR](https://github.com/knadh/oat) to list an extension here.
---
### Content/Other Libs (docs/content/other-libs.md)
+++
title = "Other useful libs"
description = "Useful zero-dependency libs"
+++
Zero-dependency, useful JS libs that can be used with Oat.
- [**tinyrouter.js**](https://github.com/knadh/tinyrouter.js): A tiny, zero-dependency lib for frontend routing and navigation on top of `window.history`. ~950 bytes.
- [**highlighted-input.js**](https://github.com/knadh/highlighted-input.js): Super tiny, zero dep Javascript lib that highlights specific keywords and tags in an `` field. ~450 bytes
- [**floatype.js**](https://github.com/knadh/floatype.js): A tiny, zero-dependency, floating autocomplete / autosuggestion widget for textareas. ~1200 bytes
- [**dragmove.js**](https://github.com/knadh/dragmove.js): A super tiny Javascript library to make DOM elements draggable and movable. ~500 bytes.
- [**indexed-cache.js**](https://github.com/knadh/indexed-cache): A tiny Javascript library for sideloading static assets on pages and caching them in the browser's IndexedDB for longer-term storage. ~2.1 KB
---
### Content/Recipes (docs/content/recipes.md)
+++
title = "Recipes"
weight = 172
description = "Composable UI recipes using existing Oat components."
[extra]
webcomponent = true
+++
Examples for various composable widgets using Oat components.
--------
## Split button
Use `menu.buttons` for joined controls and `ot-dropdown` for secondary actions.
{% demo() %}
```html
```
{% end %}
## Radio cards
Wrap each option in a `