This paragraph is styled automatically.
element using role attributes for accessibility.
```html
Account
Password
Notifications
Account Settings
Manage your account information here.
Password Settings
Change your password here.
Notification Settings
Configure your notification preferences.
```
--------------------------------
### Configure always-collapsible sidebar
Source: https://github.com/knadh/oat/blob/master/docs/content/components/sidebar.md
Set data-sidebar-layout="always" on the container to keep the toggle visible on all screen sizes.
```html
...
```
--------------------------------
### Create Accordion Components with HTML
Source: https://github.com/knadh/oat/blob/master/docs/content/components/accordion.md
Uses native HTML5 elements for collapsible content. The name attribute can be used to group multiple details elements together.
```html
What is Oat
Oat is a minimal, semantic-first UI component library with zero dependencies.
How do I use it
Include the CSS and JS files, then write semantic HTML. Most elements are styled by default.
Is it accessible
Yes! It uses semantic HTML and ARIA attributes. Keyboard navigation works out of the box.
This is grouped with the next one
Using the name attribute groups items like radio.
This is grouped with the previous one
Using the name attribute groups items like radio.
```
--------------------------------
### Create a dropdown menu with ot-dropdown
Source: https://github.com/knadh/oat/blob/master/docs/content/components/dropdown.md
Uses the popovertarget attribute to link a button trigger to a menu element containing menuitem roles.
```html
Options
```
--------------------------------
### Jinja Component Loop
Source: https://github.com/knadh/oat/blob/master/docs/templates/base.html
A Jinja template snippet that iterates over component pages, displaying their titles and indicating if they are web components.
```jinja
{% set components = get_section(path="components/_index.md") %} {% for component in components.pages %}* [{{ component.title }} {% if component.extra.webcomponent | default(value=false) %}WC{% endif %}](/components/#{{ component.slug }}) {% endfor %}
```
--------------------------------
### Apply Button Variants
Source: https://github.com/knadh/oat/blob/master/docs/content/components/button.md
Use data-variant attributes for semantic styling and classes for visual variations like outline or ghost buttons.
```html
Primary
Secondary
Danger
Outline
Danger
Ghost
Disabled
```
--------------------------------
### Apply Button Sizes
Source: https://github.com/knadh/oat/blob/master/docs/content/components/button.md
Apply .small or .large classes to adjust button dimensions. Hyperlinks can also be styled as buttons using the .button class.
```html
Small
Default
Large
Hyperlink
```
--------------------------------
### Displaying meter elements with varying values
Source: https://github.com/knadh/oat/blob/master/docs/content/components/meter.md
Use the meter element to visualize values within a defined range. The browser automatically adjusts colors based on the provided low, high, and optimum attributes.
```html
```
--------------------------------
### Apply Theme Before Rendering
Source: https://github.com/knadh/oat/blob/master/docs/templates/base.html
This JavaScript code snippet prevents a Flash of Unstyled Content (FOUC) by applying the user's preferred theme before the page renders. It reads the theme from local storage.
```javascript
(function() { var t = localStorage.getItem('theme'); if (t) { document.documentElement.style.colorScheme = t; document.documentElement.setAttribute('data-theme', t); } })();
```
--------------------------------
### Create a popover element with ot-dropdown
Source: https://github.com/knadh/oat/blob/master/docs/content/components/dropdown.md
Wraps an article element in ot-dropdown to display complex content like confirmation dialogs.
```html
Confirm
```
--------------------------------
### Overlay Spinner
Source: https://github.com/knadh/oat/blob/master/docs/content/components/spinner.md
Adding `data-spinner="overlay"` dims the container's contents and overlays the spinner on top. This is useful for indicating loading states within specific components.
```html
This is the card content. It can contain any HTML.
```
--------------------------------
### Create Avatar Group
Source: https://github.com/knadh/oat/blob/master/docs/content/components/avatar.md
Wrap multiple avatars within a `` to create an avatar group. The `.small` or `.large` classes on the group container control the size of all avatars within it.
```html
```
--------------------------------
### Basic Toggle Switches
Source: https://github.com/knadh/oat/blob/master/docs/content/components/switch.md
Use `role="switch"` on an input of type `checkbox` to enable toggle switch styling. This allows for native HTML switches without JavaScript.
```html
Notifications
Confabulation
```
--------------------------------
### Create a Form Card with Oat
Source: https://github.com/knadh/oat/blob/master/docs/content/recipes.md
Groups related form fields inside a card with standard field containers and actions.
```html
Name
Email
Email notifications
```
--------------------------------
### HTML Typography Elements
Source: https://github.com/knadh/oat/blob/master/docs/content/components/typography.md
Demonstrates the default styling for headings, paragraphs, links, inline code, code blocks, blockquotes, horizontal rules, and lists. These elements are styled automatically without needing specific classes.
```html
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
```
```html
This is a paragraph with bold text , italic text , and a link .
```
```html
Here's some inline code and a code block:
```
```html
This is a blockquote. It's styled automatically.
```
```html
```
```html
Unordered list item 1
Unordered list item 2
Unordered list item 3
```
```html
Ordered list item 1
Ordered list item 2
Ordered list item 3
```
--------------------------------
### Clear Toasts
Source: https://github.com/knadh/oat/blob/master/docs/content/components/toast.md
Use `ot.toast.clear()` to dismiss all active toasts or `ot.toast.clear(placement)` to dismiss toasts from a specific screen position.
```javascript
ot.toast.clear() // Clear all
ot.toast.clear('top-right') // Clear specific placement
```
--------------------------------
### Create Single Avatar
Source: https://github.com/knadh/oat/blob/master/docs/content/components/avatar.md
Use `` with an ` ` tag for image avatars, or `` for text initials. The `aria-label` attribute is important for accessibility.
```html
OT
```
--------------------------------
### Validation Error Display
Source: https://github.com/knadh/oat/blob/master/docs/content/components/form.md
Illustrates how to display validation errors by using `data-field="error"` on field containers and including an error message element.
```html
```
--------------------------------
### Jinja Template Title Block
Source: https://github.com/knadh/oat/blob/master/docs/templates/base.html
A Jinja template block used to set the page title, likely for dynamic content generation.
```jinja
{% block title %}{{ config.title }}{% endblock %}
```
--------------------------------
### HTML Alert Messages with Variants
Source: https://github.com/knadh/oat/blob/master/docs/content/components/alert.md
Use `role="alert"` for semantic alert messages. Set the `data-variant` attribute to `success`, `warning`, or `error` to apply specific styling. If no variant is specified, a default info style is applied.
```html
Success! Your changes have been saved.
Warning! Please review before continuing.
Info This is a default alert message.
Error! Something went wrong.
```
--------------------------------
### Inline Dialog Close Handler
Source: https://github.com/knadh/oat/blob/master/docs/content/components/dialog.md
Alternatively, use the `onclose` attribute directly on the `` element for inline handling of the close event, providing a concise way to log the return value.
```html
```
--------------------------------
### HTML Breadcrumb Navigation
Source: https://github.com/knadh/oat/blob/master/docs/content/components/breadcrumb.md
Use a semantic breadcrumb `` with an ordered list and `aria-current="page"` for the active item. Ensure proper ARIA attributes for accessibility.
```html
Home
/
Projects
/
Oat Docs
/
Breadcrumb
```
--------------------------------
### Handling Dialog Close Event
Source: https://github.com/knadh/oat/blob/master/docs/content/components/dialog.md
Listen to the native `close` event on the dialog element to retrieve the `returnValue` of the button that closed the dialog. This allows for programmatic handling of dialog results.
```javascript
const dialog = document.querySelector("#demo-dialog");
dialog.addEventListener('close', (e) => {
console.log(dialog.returnValue);
});
```
--------------------------------
### Clearing Toasts
Source: https://github.com/knadh/oat/blob/master/docs/content/components/toast.md
Provides methods for programmatically dismissing toast notifications.
```APIDOC
## Clearing Toasts
### Description
Methods to dismiss toast notifications, either all at once or from a specific placement.
### Method
`ot.toast.clear(placement?)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```js
ot.toast.clear() // Clear all toasts
ot.toast.clear('top-right') // Clear toasts from a specific placement
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
--------------------------------
### Dialog with Form Fields
Source: https://github.com/knadh/oat/blob/master/docs/content/components/dialog.md
Forms within dialogs function naturally. Use `command="close"` on cancel buttons to close the dialog without submitting the form.
```html
Open form dialog
```
--------------------------------
### Disabled Toggle Switches
Source: https://github.com/knadh/oat/blob/master/docs/content/components/switch.md
Add the `disabled` attribute to a checkbox with `role="switch"` to create disabled toggle switches. This applies to both the 'off' and 'on' states.
```html
Disabled off
Disabled on
```