@latty-ds/web
v0.6.0
Published
Web Components for the Latty design system — framework-agnostic UI components built with Lit
Downloads
659
Maintainers
Readme
@latty-ds/web
Web Components for the Latty Design System — framework-agnostic UI components built with Lit and driven by design tokens.
Installation
pnpm add @latty-ds/tokens @latty-ds/webSetup
Import the CSS tokens once in your app entry point, then import the component library:
/* your global stylesheet */
@import '@latty-ds/tokens/tokens.css';
@import '@latty-ds/tokens/semantic.css';import '@latty-ds/web';Or import individual components to keep bundles small:
import '@latty-ds/web/dist/components/button';
import '@latty-ds/web/dist/components/textfield';Components
Buttons, inputs, overlays, navigation, data display, and more — all prefixed lt-*. See the full component reference for props, events, and live examples.
Usage
Components work in any HTML environment — no framework required.
<lt-button variant="primary" size="md">Save changes</lt-button>
<lt-textfield label="Email" type="email" required></lt-textfield>
<lt-badge variant="success">Active</lt-badge>
<lt-spinner size="md" variant="primary"></lt-spinner>Common props
Most components share these props:
variant—primary|secondary|neutral|success|warning|error|infosize—sm|md|lgdisabled— boolean
All props reflect to HTML attributes, so server-rendered markup works out of the box.
Icons
Pass an icon name to components that support them:
<lt-button icon="save">Save</lt-button>
<lt-button icon-end="arrow-right">Next</lt-button>
<lt-textfield icon-start="search" placeholder="Search…"></lt-textfield>See @latty-ds/icons for the full icon reference.
CSS customization
Components expose CSS parts for external styling:
lt-button::part(button) {
border-radius: 999px;
}All visual properties are driven by --lt-* CSS custom properties. Override tokens globally or per-component:
:root {
--lt-interactive-primary-bg: hotpink;
}
lt-button {
--lt-interactive-primary-bg: hotpink;
}TypeScript
Full type definitions are included. Import types directly:
import type { Button } from '@latty-ds/web';The custom-elements.json manifest (at the package root) is compatible with VS Code's custom data format for HTML IntelliSense.
License
MIT
