# Summit.js: Full Documentation > The open source, AI Agent Native JavaScript framework. Add behavior directly in your HTML with signal-powered s- directives and $ magics. No build step, CSP-safe, about 16KB with focus, positioning, persistence, and masking built in. Every documentation page, concatenated as markdown in reading order. Source: https://velofy.github.io/summitjs --- # Getting Started > Summit is a rugged, signal-powered JavaScript framework for composing behavior directly in your HTML. Learn what it is and write your first component. Summit is a small JavaScript framework for composing behavior directly in your markup. You sprinkle a handful of `s-` attributes onto plain HTML and Summit brings it to life. No build step, no components to import, no JSX. If you know HTML, you already know most of Summit. Under the hood it runs on a fine-grained signal engine, so when a value changes Summit updates only the exact piece of DOM that depends on it. Expressions are parsed and interpreted rather than handed to `eval`, so Summit works under a strict Content-Security-Policy with nothing extra to configure. ## Your first component Here is a complete, working counter. There is no setup around it: this snippet is running live on the page right now. ```summit
0
``` `s-data` declares a piece of state. `@click` (shorthand for `s-on:click`) runs an expression when the button is clicked. `s-text` keeps the `` in sync with `count`. When you click, only that one number re-renders. ## Why Summit - **Fine-grained reactivity.** A real signal engine tracks exactly which expressions read which values, so updates are surgical rather than re-rendering whole subtrees. - **CSP-safe by default.** Expressions run through a hand-written interpreter. No `eval`, no `new Function`, no `unsafe-eval` in your policy. - **Tiny and buildless.** The whole runtime is roughly 16KB gzipped. Drop in one script tag and it starts on its own. - **Familiar.** Fifteen directives, nine magic properties, and the `@` and `:` shorthands. If you have used an HTML-first framework before, this will feel like home, with the rough edges filed off. ## Where to go next - [Installation](../installation/) covers the script tag, npm, and bundlers. - [Reactivity and State](../reactivity-state/) explains `s-data`, computed values, and methods. - The [Directives](../s-data/) and [Magic Properties](../magic-el/) sections are a complete reference for every attribute and helper. --- # UI Library > An accessible, token-themed component library you copy into your markup and theme with CSS variables. Built with Summit, for people and AI agents. Summit ships a copy-in UI library: a set of accessible, token-themed components you drop straight into your HTML. There is no component runtime to install. Each one is plain markup plus a class, and the interactive ones are wired with the same `s-` directives you already know. Theme the whole set by changing a few CSS variables. It is built the way an AI agent likes to work: predictable class names, behavior that lives on the element, and nothing that needs a build step. ```summit
Live
``` ## Using a component Load the stylesheet once, then copy any component's markup. ```html ``` Or copy the rules you need out of `components.css` into your own styles. Every class is prefixed `s-`, so nothing collides with your existing CSS. ## Theming Components read the same design tokens as the rest of Summit. Override them on `:root` (or any scope) and the whole set restyles. The most useful ones: ```css :root { --accent: #ea580c; /* primary / brand color */ --s-radius: 12px; /* corner rounding */ --s-danger: #e11d48; /* destructive actions */ } ``` Light and dark are handled for you through `prefers-color-scheme` and the `data-theme` attribute, exactly like this documentation. ## Accessibility Interactive components ship with the roles and keyboard behavior you expect: focus rings on every control, `Escape` to close overlays, click-outside to dismiss menus, and labels wired to their inputs. Where a component needs an id to pair a label with a control, use the [$id](../magic-id/) magic. ## The components **Forms** [Button](../comp-button/), [Input](../comp-input/), [Select](../comp-select/), [Checkbox & Radio](../comp-checkbox/), [Switch](../comp-switch/) **Data display** [Card](../comp-card/), [Badge & Tag](../comp-badge/), [Alert](../comp-alert/), [Avatar](../comp-avatar/), [Progress & Spinner](../comp-progress/) **Overlays** [Dialog](../comp-dialog/), [Dropdown Menu](../comp-menu/), [Popover](../comp-popover/), [Tooltip](../comp-tooltip/), [Toast](../comp-toast/) **Navigation** [Tabs](../comp-tabs/), [Accordion](../comp-accordion/), [Breadcrumb](../comp-breadcrumb/), [Pagination](../comp-pagination/) --- # Button > Buttons with solid, outline, ghost, subtle, and danger variants, plus sizes and groups. Buttons trigger actions. Everything starts from one base class, `.s-btn`, and you add modifiers for variant, size, and shape. Because behavior lives on the element, you can wire any button up with the same `s-` directives you already use. ```summit
``` ## Variants The base `.s-btn` is the solid, high-emphasis button. Add one modifier class to change its emphasis. Use `.s-btn-danger` for destructive actions so the intent reads at a glance. ```summit
``` ## Sizes `.s-btn-sm` and `.s-btn-lg` adjust height and padding. Without either, a button uses the default size. ```summit
``` Add `.s-btn-block` to stretch a button to the full width of its container, which is handy at the end of a form. ## Icon buttons `.s-btn-icon` makes a square button sized for a single glyph. Drop an inline SVG inside and give the button an `aria-label`, since there is no visible text to name it. ```summit
``` ## Groups Wrap two or more buttons in `.s-btn-group` to join them into a single segmented control. The group squares off the inner corners and collapses the shared borders for you. ```summit
``` ## Disabled The native `disabled` attribute dims a button and removes it from the tab order. Bind it reactively with [`:disabled`](../s-bind/) to gate an action on state. ```summit
``` ## Copy and paste ```html
``` ## Accessibility Always use a real ` ``` ## Anatomy A card is a `.s-card` wrapper around three optional regions, each with its own padding so they line up without extra spacing rules. - `.s-card-header` holds the `.s-card-title` and an optional `.s-card-desc`. - `.s-card-body` is the main content area. - `.s-card-footer` lays out actions in a row with a gap, ready for [buttons](../comp-button/). The wrapper clips its corners with `overflow: hidden`, so a full-bleed image or a colored bar as the first child follows the rounded edge cleanly. ## Body-only card Drop the header and footer when all you need is a framed block of content. ```summit
Every region is optional. A card with only a body is still a tidy, bordered surface you can drop anywhere in a grid.
``` ## Copy ```html

Upgrade to Pro

Lift the project cap and add your whole team.

You are on the Free plan, which tops out at three projects.
``` ## Notes - The card sets a width of whatever it sits in, so control its size from the parent layout (a grid, a flex row, or a `max-width` like the demos above). - The title renders as an `h3` here, but the class carries the styling. Use the heading level that fits your document outline. - Footer actions align to the start. To push them to the right, add your own `style="justify-content:flex-end"` or a utility class. Pair cards with [badges](../comp-badge/) for status and [avatars](../comp-avatar/) for people. See the full set on the [overview](../components/). --- # Badge & Tag > Small status labels and removable tags. Badges are small, uppercase labels for status and counts: a build that passed, a plan tier, an item count on a menu. Tags are their rounded, softer cousin, sized for user-entered keywords and built to carry a remove button. Both are plain markup, and the tag's button is where a little Summit state turns a static list into an editable one. ```summit
Default Solid Outline Info Success Warning Danger
``` ## Badge variants The base `.s-badge` uses your accent tint. Add one modifier to change its weight or meaning: - `.s-badge-solid` fills with the accent color for the strongest emphasis. - `.s-badge-outline` is a quiet, bordered label. - `.s-badge-info`, `.s-badge-success`, `.s-badge-warning`, and `.s-badge-danger` map to the semantic feedback palette, the same colors the [alert](../comp-alert/) component uses. ```html Passing 3 failed Draft ``` ## Removable tags A `.s-tag` is a pill with an inner ` ``` ## Driving the width The bar is a `.s-progress` track with a single inner ``. You never set a value attribute; you set the span's width, and the CSS transition animates the fill. Bind it with `:style` so the width tracks whatever number lives in state. ```summit
``` Keep the number inside `0` to `100`. Clamping with `Math.max` and `Math.min` when you change it, as the demo above does, means a stray click can never push the fill past either end. ## Spinner `.s-spinner` is a standalone element for indeterminate waits, when you know work is happening but not how far along it is. It needs no state and no inner markup, just the class. Pair it with a label so the reason for the wait is clear. ```summit
Loading your workspace
``` ## Skeleton `.s-skeleton` is a shimmering placeholder block. Give it an inline width and height so it matches the shape of the content it is standing in for, then stack several to preview a whole card or list row. ```summit
``` ## Copy and paste ```html
``` ## Notes - The bar carries no semantics on its own. Add `role="progressbar"` with `aria-valuemin`, `aria-valuemax`, and a bound `:aria-valuenow` so screen readers announce the position, as the top demo does. - Give the spinner `role="status"` and an `aria-label` so its purpose reaches people who cannot see it turn. - Both the spinner's spin and the skeleton's shimmer stop under `prefers-reduced-motion`, so you do not need to disable them yourself. - Once a load finishes, a [Toast](../comp-toast/) or an [Alert](../comp-alert/) is a good way to confirm the result. See all the pieces on the [UI Library overview](../components/). --- # Tooltip > A CSS-only tooltip that appears on hover and focus. A tooltip is a small label that appears next to a control to explain what it does. Summit's version is pure CSS: it shows while the wrapper is hovered or holds focus, and hides again on its own. There is no `s-data`, no directive, and no JavaScript to wire up. You just nest the tip inside the trigger. ```summit Saved just now ``` ## Structure A tooltip is two parts inside one wrapper: - `.s-tooltip` is the wrapper. It positions the tip and listens for hover and focus through CSS alone. - Inside it goes your trigger (a button or link) and a `` holding the text. The tip is hidden until the wrapper matches `:hover` or `:focus-within`, so it appears both when you point at the trigger and when a keyboard user tabs onto it. That is why the trigger should be a naturally focusable element. If you wrap something that is not focusable, add `tabindex="0"` so keyboard users reach it too. ## Any trigger The wrapper works around a button, an icon button, or plain inline text. Keep the tip short: it renders on a single line and does not wrap. ```summit
Goes live immediately What is this?
``` ## Copy and paste ```html Helpful hint ``` ## Notes - No state is involved. The tooltip needs no `s-data` and adds nothing to your JavaScript, so you can drop it anywhere, even into otherwise static markup. - Because it is CSS-only, the tip always sits above the trigger and centered. It does not measure the viewport or flip to stay on screen, so avoid it right at the top edge of the page. - Text stays on one line by design. For anything longer, or for content that should open on click and hold buttons or fields, reach for a [Popover](../comp-popover/) instead. - Browse the rest of the set on the [UI Library overview](../components/). --- # Dialog > A modal dialog for confirmations and focused tasks, with overlay and Escape to close. A dialog interrupts the page to ask for a decision or hold a short, focused task. It draws an overlay across the page, floats a panel in the center, and traps the user's attention until they act or dismiss it. Everything is driven by one piece of state: a boolean that says whether the dialog is open. A button flips it on, and the overlay, the close button, and the `Escape` key flip it back off. ```summit
``` ## Opening and closing The whole component lives on the `open` boolean in `s-data`. The trigger button sets it to `true`, and every path out of the dialog sets it back to `false`. The overlay and panel sit inside a `