Blocks
Whole pages you copy into your project with one command, built only from Focsd's public APIs.
A block is a complete, accessible page: plain HTML, one JS module and, for some blocks, a small CSS file. npx focsd add block <name> writes it into blocks/<name>/ in your project. It is only markup and the elements it imports, so it fits any framework, but it needs a bundler or an import map (see below).
npx focsd list --blocksnpx focsd add block dashboardnpx focsd add block dashboard --out src/pages/overview- It never overwrites. If any target file exists, the command writes nothing, lists the files in the way and exits with code 1.
--overwriteis refused for blocks. Pick another folder with--out, which is relative to the project root. - It uses the packages. The JS imports
@focsd-dev/components/focsd-*.js(plus@focsd-dev/chartsand@focsd-dev/data-gridfor the dashboard). The command prints thenpm installline for the block. Afocsd.jsonis not required; if you copied components withfocsd add, those win and the block works with them. - The text is yours. The sample content is in the HTML, so edit it in place. Block strings are not routed through
registerTranslation. - It needs a bundler or an import map. The block’s script imports bare specifiers (
@focsd-dev/components/focsd-card.js), which a plain static server cannot resolve: the page stays blank. Openblocks/<name>/index.htmlwith Vite, Parcel, webpack or another dev server that resolves bare imports, or add an import map. The two<link>tags for@focsd-dev/tokenspoint at/node_modules/@focsd-dev/tokens/dist/; in a bundler setup, replace them withimport '@focsd-dev/tokens/tokens.css'in the block’s script. - It sends nothing. Settings and sign-in validate on the page and send no request. Settings fires a cancelable
settings:saveevent; the sample handler insettings.jsresolves at once, so replace it with your own save call. Sign-in’s form has an emptyaction: set your endpoint there or handle the submit insign-in.js. - Icons. Sidebars use the built-in icons (
home,inbox,users,package,settingsand more). Register your own icon set to use any other icon, and change theiconattributes.
Dashboard
Section titled “Dashboard”An app shell with a sidebar, four stat tiles, a revenue chart and a sortable, paginated orders grid.
npx focsd add block dashboardNeeds: npm install @focsd-dev/components @focsd-dev/charts @focsd-dev/data-grid @focsd-dev/tokens. Uses 14 elements: app-shell, avatar, chart, data-grid, footer, header, icon-button, menu, menu-item, sidebar, sidebar-item, sparkline, stat, theme-toggle.
The sidebar becomes a drawer below 768 px, the four stat tiles wrap to two columns and then one, and the orders grid scrolls inside its own wrapper on a phone.
Settings
Section titled “Settings”App shell with a tabbed settings form: profile, notifications and security, an error summary and a Saved announcement.
npx focsd add block settingsNeeds: npm install @focsd-dev/components @focsd-dev/tokens. Uses 15 elements: app-shell, button, error-summary, fieldset, header, option, select, sidebar, sidebar-item, switch, tab, tab-panel, tabs, text-field, theme-toggle.
A tabbed form. An invalid email stops the submit and moves focus to the error summary. Saving announces “Settings saved” and sends nothing: wire your own request.
Sign in
Section titled “Sign in”Centered sign-in card with email, password and remember me, correct autocomplete tokens and an error summary. Sends nothing.
npx focsd add block sign-inNeeds: npm install @focsd-dev/components @focsd-dev/tokens. Uses 7 elements: button, card, checkbox, error-summary, link, password-field, text-field.
A centered card with autocomplete tokens that password managers understand. It sends nothing; replace the form action and the submit handler with your sign-in call.
Empty app
Section titled “Empty app”App shell with header and sidebar and a first-run empty state with a primary action and a secondary link.
npx focsd add block empty-appNeeds: npm install @focsd-dev/components @focsd-dev/tokens. Uses 8 elements: app-shell, button, empty-state, header, link, sidebar, sidebar-item, theme-toggle.
A shell with a header and sidebar and an empty state in main. The skip link reaches main, and there is one main landmark.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.