Getting Started
These examples use the current Astro adapter. Import ClassiJS components in any Astro file, use props for behavior and slots for content.
Build a form
Native form attributes pass through to the control. This includesname, required and type. Form controls keep their browser submission behavior.
src/pages/profile.astro
---
import { Button, Checkbox, Panel, TextField } from 'classijs';
---
<Panel title="Profile" padded>
<form method="post">
<TextField label="Name" name="name" required />
<TextField label="Email" name="email" type="email" required />
<Checkbox name="updates">Email me product updates</Checkbox>
<Button type="submit">Save changes</Button>
</form>
</Panel>Compose interactive components
Components that need browser behavior initialize it themselves. Tabs, menus, pickers and collapsible panels do not need a separate setup script.
---
import { Tab, TabPanel, Tabs } from 'classijs';
---
<Tabs id="account" label="Account settings">
<Fragment slot="tabs">
<Tab id="profile" selected>Profile</Tab>
<Tab id="security">Security</Tab>
</Fragment>
<TabPanel for="profile" selected>
Profile settings
</TabPanel>
<TabPanel for="security">
Security settings
</TabPanel>
</Tabs>Connect related components
A Tab and its TabPanel share the same identifier through id and for. Mark the initial tab and panel as selected.
Use native attributes
Pass disabled, href, aria-label and other supported HTML attributes directly to a component. Icon-only controls need an accessible name. Keyboard behavior is included in the component.