By the end of 0.2, src/components/ui/ was a single flat folder. Components, their React versions and their helpers all sat side by side, and finding the right file meant scrolling. Each component also kept its own map of variant classes, written a slightly different way every time.
That works for a handful of components. It doesn’t work for a design system people are meant to extend.
Velocity 0.3 beta (February 10) and 0.4 beta (February 12) rebuild the component layer: a folder per component, grouped by category, typed variants with CVA, and a registry that tells the CLI what each component needs. 0.4.1 followed with an analytics fix.
Components grouped by category
Every UI component now lives in its own folder, with its Astro component, React version, variants and barrel export together. The folders are grouped into eight categories:
| Category | Components |
|---|---|
form/ | Button, Input, Textarea, Select, Checkbox, Radio, Switch |
data-display/ | Card, Badge, Avatar, AvatarGroup, Table, Pagination, Progress, Skeleton |
feedback/ | Alert, Toast, Tooltip |
overlay/ | Dialog, Dropdown, Tabs, VerticalTabs, Accordion |
layout/ | Separator |
primitives/ | Icon |
content/ | CodeBlock |
marketing/ | Logo, CTA, NpmCopyButton, SocialProof, TerminalDemo |
That’s 31 UI components. A Button looks like this on disk:
src/components/ui/form/Button/
Button.astro
Button.tsx
button.variants.ts
index.tsEach category has its own barrel, and src/components/ui/index.ts re-exports all of them, so existing barrel imports keep working.
Variants with CVA
0.3 moves component variants to Class Variance Authority (CVA). Each component that has variants gets a .variants.ts file that exports a typed variant function and its inferred type:
import { cva, type VariantProps } from 'class-variance-authority';
export const buttonVariants = cva(
['inline-flex items-center justify-center gap-2', 'font-medium rounded-md'],
{
variants: {
variant: { primary: '...', secondary: '...', outline: '...', ghost: '...' },
size: { sm: '...', md: '...', lg: '...' },
},
defaultVariants: { variant: 'primary', size: 'md' },
}
);
export type ButtonVariants = VariantProps<typeof buttonVariants>;The Astro and React versions of a component share the same file, so a variant can’t drift between them. Compound variants handle the combinations, such as an icon-only button at each size, or a pill Badge that needs different padding.
The Hero, Header and Footer use the same approach. By 0.4 there are 20 .variants.ts files in the project.
0.3 also adds new components and patterns, including Accordion, AvatarGroup, Pagination, Progress, Separator, Switch, Table and Toast, plus the SearchInput, PasswordInput, StatCard and EmptyState patterns. In 0.4, ten display, feedback and layout components (among them Badge, Table, Alert and Tooltip) accept and forward any HTML attribute, so data-* and aria-* attributes reach the element.
A registry the CLI can rely on
component-registry.json moves to version 2.0.0. Each entry lists a component’s files, its category and subcategory, and what it depends on:
"password-input": {
"name": "PasswordInput",
"category": "patterns",
"files": ["src/components/patterns/PasswordInput.astro"],
"dependencies": {
"utilities": ["cn"],
"components": ["input", "icon"]
}
}The create-velocity-astro CLI uses it to scaffold a project with the components you chose and everything they import. At 0.4.1 the registry has 41 entries: the 31 UI components, seven patterns, the Hero, the Header and the Footer.
The upgrade manifest from Velocity 0.2 now adds class-variance-authority as a dependency, treats src/styles/themes/ as a file Velocity can update, and lists migrations for renamed and removed props.
Contrast that passes WCAG AA
Two steps in the gray scale fell short of WCAG AA contrast. 0.3 raises their OKLCH lightness:
| Token | Before | After |
|---|---|---|
--gray-400 | 50% | 64% |
--gray-500 | 42% | 52% |
--gray-700 also moves from 37.5% to 32%, because it was only half a point away from --gray-600. Dark mode’s --foreground-subtle goes from 3.7:1 to about 4.6:1, and the default theme now notes the contrast ratio and WCAG level next to each foreground token, so you can check your changes against them.
The same release fixes Switch accessibility: its description is linked with aria-describedby, and the React version no longer toggles twice when you click its label.
CSP follow-ups
Velocity 0.2 turned on a Content Security Policy, and running it found a few things it blocked:
- Fonts: the Google Fonts stylesheet loaded through an inline
onloadhandler, which CSP blocks. Velocity now self-hosts Manrope, Outfit and JetBrains Mono through Fontsource, and the Google Fonts domains are gone from the policy. - Tab panels: inline
style="display: none"was blocked, so every panel rendered at once before hydration. Panels now use thehiddenattribute. - Analytics: in 0.4.1 the GA4 script tag gets
is:inline. Without it, Astro’s build dropped the external script, sogtag.jsnever loaded.
Blog images, TechStack and init guards
0.4 swaps the raw <img> tags in the blog for Astro’s Image component. Posts pass full ImageMetadata objects instead of URL strings, so cover images get WebP or AVIF conversion, a responsive srcset and width and height attributes that prevent layout shift.
The TechStack section on the landing page is rebuilt from Velocity’s own Card, Badge and Icon components, with a brand color for each technology and pill badges for version labels.
Tooltip, Dialog, Dropdown, Tabs and VerticalTabs now mark themselves as initialized with a data-* flag. Their init functions also run on astro:page-load, and the guard means a second call won’t attach duplicate listeners. The same release adds small animations for input errors, tab changes, toasts and tooltips, all of which respect prefers-reduced-motion.
Under the hood, 0.4 moves to Astro 6.0.0-beta.11 and generates share images with Sharp instead of @resvg/resvg-js. Sharp is listed as a direct dependency so it resolves on Vercel. Share images also render their description as text instead of escaped HTML.
Get it
Start a new project:
pnpm create velocity-astro my-projectThe full changelog is in the commit history on GitHub. If you import components by their file path, update the paths to the new category folders.