# UI `@elements/ui` is the UI package: some eighty templates, from Button and Input to Dialog, Select, DataTable and Toast, the behaviors they are built from, twelve themes, and the stylesheet they share: the tokens, the type scale, the layout primitives and the classes for buttons, forms, cards and pills. It covers all of the primary UI templates an app will need; anything else can be composed or created from these primitives. A template is an Elements HTML template imported from its own path and written like any tag, with typed attributes, slots and two-way state. It renders on the server, so the page arrives finished, and it imports its own CSS, so importing a template styles it. ## Install Every new app has it: `elements create` pins `@elements/ui` in `config.jsoc` and imports it in `app/shared/styles/page.css`, so there is nothing to install. It is its own package, versioned apart from the Elements tooling, and an app that wants none of it removes it with `elements uninstall @elements/ui` and deletes the import. ```css app/shared/styles/page.css @import "@elements/ui"; @import "./vars.css"; ``` The import loads the base classes (the design system: tokens, the reset, bare element styling, typography, layout and utilities), the theme contract the templates read, and the default look. `vars.css` holds the app's own token overrides, so it comes after. See `elements man style` for the classes and tokens. ## Import a template One import per template, from `@elements/ui/`, where `` is the page name in the table below. A template's parts come from the same path: ```ehtml app/pages/settings/template.ehtml import { Button } from "@elements/ui/button"; import { Dialog, DialogFooter, DialogClose } from "@elements/ui/dialog"; ``` Attributes are typed: a `variant` that does not exist is a build error, and the editor completes the ones that do. An attribute its page marks two-way can be bound to state. `` opens and closes from the page, and the dialog writes `false` back when the user closes it; written as a literal, ``, the template owns the state. Every template takes `class` for extra classes on its root, and a template with a native element at its root takes `attrs` for any other attribute on it. Read a template's page before you build with it: `elements man ui/templates/dialog`. The order of reach is a template before a class, and a class before a rule of your own. A `