For a single minified Anta runtime and stylesheet, use the bundle pair instead
of the separate tokens, reset, elements, and JSX imports:
import'@antadesign/anta/bundle.css'
import{ Progress }from'@antadesign/anta/bundle'
<Progressvalue={42}label="Uploaded"hint="3 of 7"/>
bundle registers every custom element and re-exports the JSX API. Its React
peer dependency and Preact configuration are the same as the regular JSX entry.
Tokens, elements, and the JSX layer render a styled component. The reset is
recommended; the reference theme is optional.
Import
Provides
Skip if…
@antadesign/anta/tokens.css
Six seed tokens, derived role scales (--bg-1…5, --text-1…5, --border-1…5), .dark and its color-scheme, the 15px root size, and layer order. Override a seed to reskin its tone.
You provide those variables.
@antadesign/anta/reset.css
A small reset plus Anta’s focus, heading, list, and link typography in @layer anta.reset.
You use another reset and typography.
@antadesign/anta/elements
Registers every <a-*> element and its CSS. Per-element entries register one; see Registering elements.
You render only on the server or register elements individually.
@antadesign/anta
Typed React/Preact wrappers such as Progress, Text, and Icon.
You write <a-*> elements directly.
@antadesign/anta/bundle.css
One minified stylesheet containing tokens, reset, element, and JSX-wrapper styles.
You want granular CSS imports.
@antadesign/anta/bundle
One minified ESM runtime that registers every <a-*> element and re-exports the JSX API.
You want granular JS imports.
@antadesign/anta/theme-antune.css(optional)
Antune, the hand-tuned reference palette. Import last to replace the seed-derived default.
You want the seed-derived or your own palette.
@antadesign/anta/theme-antithesis.css(optional)
Antithesis: warm color seeds, pill buttons, square text fields, and 1px tag corners. Import as the only theme.
You want Antune, the seed-derived palette, or your own theme.
Load tokens.css before element CSS. Elements read its variables; without it,
they render unstyled.
To use the optional reference palette, import theme-antune.css after the element
registration import. It ships in @antadesign/anta; omit it to keep the
seed-derived default palette or provide your own theme.
Anta’s reset and element CSS use child layers inside @layer anta. Every Anta
stylesheet reserves the same order, so granular stylesheets remain safe when a
bundler loads them before tokens.css:
@layer base, anta, components, utilities;
@layer anta.reset, anta.components, anta.theme;
anta.theme lets the optional reference palette replace component formulas. The
outer anta layer keeps its public cascade position.
To change that order, declare it in CSS loaded before any Anta stylesheet.
The first declaration fixes a layer’s position:
/* your global.css, loaded before anta */
@layer reset, anta, my-components, utilities;
Token custom properties stay unlayered so they apply everywhere.
Gotcha: an unlayered hard reset defeats Anta’s element rules.
*,*::before,*::after{ box-sizing:border-box; }
*{ margin:0; }
Unlayered styles beat layered ones regardless of specificity. This reset
overrides Anta’s element defaults. Delete the duplicate, or put your reset in
@layer base { … }; reset.css already applies the same universal reset in
@layer anta.reset.
Anta includes version-matched Markdown documentation in its npm package.
Append this section to your application’s agent instruction file, such as
AGENTS.md, CLAUDE.md, or your tool’s equivalent. Keep existing project rules:
##Anta
Before Anta UI work, read
`node_modules/@antadesign/anta/docs/index.md`
and the pages relevant to the task.
Verify component names, imports, props, and event signatures against the
installed documentation and TypeScript declarations. Do not infer Anta APIs
from similarly named components in other libraries.
The path is relative to the application directory where Anta is installed.
Adjust it for your workspace or package-manager layout. Installing Anta does
not modify your agent configuration.
For tools without local file access, provide the web documentation index
and your installed Anta version. Web documentation may describe a newer release.
JSX wrappers render <a-*> tags. Register their classes before those tags reach
the DOM. Registration needs HTMLElement, so the import is a no-op in Node.js
and Worker threads.
import'@antadesign/anta/elements'// auto-registers all elements
/elements registers everything. Per-element entries register one element and
load only its CSS:
import'@antadesign/anta/elements/a-tooltip'// only <a-tooltip> + its CSS
import'@antadesign/anta/elements/a-button'// only <a-button> + its CSS
Both are idempotent, side-effect imports and safe during SSR.
Use a static import in your app entry, outside components and hooks:
// src/main.tsx (or wherever your root render lives)
Module initialisation registers the classes before the first render, avoiding a
flash of un-upgraded elements.
Why not useEffect(() => import('@antadesign/anta/elements'), [])?useEffect runs after paint and the import resolves later. The browser can
paint unregistered elements first. useLayoutEffect is still asynchronous and
warns during SSR hydration.
Choose the entry point for your runtime:
Plain HTML or static sites: a <script type="module"> in the document head.
Astro or Next.js: a client-only script. In Astro, use
<script>import '@antadesign/anta/elements'</script>; in Next.js, import it
from a 'use client' file.
Worker-rendered UI: code that runs on the UI thread and initializes the
DOM. A Worker has no HTMLElement.
Every a-* tag type-checks, standard HTML tags keep working, and importing
@antadesign/stickers adds its tags automatically.
Option B — if jsxImportSource cannot change, merge Anta’s tag map into
your JSX namespace with AntaIntrinsicElements (and StickerIntrinsicElements
when needed):
Without an optional theme, tokens.css defines system stacks in --sans-serif,
--serif, and --monospace. Reference themes register hosted fonts and replace
some of those same variables. Components and theme rules decide which stack to
use. Theme-free components do not force font-specific stylistic sets or
variable-font axes. tokens.css also sets 1rem to 15px.
Register application-owned fonts and redefine the variables in CSS loaded after
the Anta styles and optional theme. This example uses separate Roman and Italic
variable files:
Place this application stylesheet after theme-antune.css or
theme-antithesis.css, not before it. When all stylesheets are in the document
head, the override applies before the first paint. Anta’s semantic italics
(em, i, var, and dt) select the Italic face.
A variable font with a standard slnt axis can provide both instances. Expose it
through font-style: oblique instead of setting slnt on italic elements:
The browser selects 0deg for normal text and 11deg for semantic italics. Use
the range your font declares to avoid combining slnt with a synthetic oblique.
Anta targets evergreen browsers and ships no baseline polyfills. Its floor is custom-element states, used throughout the components for their internal CSS state, alongside the Popover API:
Browser
Minimum version
Chrome / Edge
125 (May 2024)
Safari
17.4 (Mar 2024)
Firefox
126 (May 2024)
This is Baseline 2024. Anta also relies on relative
OKLCH, :has(), dvh, cascade layers, and constructable shadow DOM. Older
browsers can fail hard, including :state() being unrecognized or
showPopover() throwing. Gate Anta on your own support matrix when you support
older browsers.
Two features progressively enhance with fallbacks: checkVisibility() falls
back to getClientRects(), and typed CSS attr() supports raw
<a-icon size> in Chrome 133+ and Safari 18.2+. Elsewhere use <Icon size>
or --icon-size.