@danielsoaresf/lost-ui
v0.3.0
Published
Shared React 19 + Tailwind v4 component library: primitives, app shell, forms, data, charts, effects and page templates.
Readme
lost-ui
Shared React component library for aura-creative and memoria-print. React 19, Tailwind CSS v4, shadcn/ui primitives and Radix, with animations from Motion.
It has the primitives, Nuxt UI style pieces, the frame of an internal app (sidebar, top bar, bottom bar), validated forms, a data table, charts, landing-page effects and ready-made screens (login, register, settings, notifications…). Texts come in English, Spanish and Portuguese.
What is inside
Imports use the short name lost-ui (see Install in a project).
| Layer | Import | What it is |
| ----------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| ui | lost-ui/ui | shadcn primitives (button, dialog, select…) |
| elements | lost-ui/elements | small pieces: Kbd, Chip, AvatarGroup, Stepper, Modal, Slideover, PageTransition |
| app | lost-ui/app | frame of an app: AppShell, AppSidebar, AppTopbar, BottomNav, UserMenu, ErrorPage |
| forms | lost-ui/forms | fields validated by rules (like Quasar's QForm) and FormBuilder |
| data | lost-ui/data | DataTable, Empty, Timeline, TreeView, UserInfo |
| ai-chat | lost-ui/ai-chat | AI chat: messages, prompt, reasoning, tool calls |
| calendar | lost-ui/calendar | month, week and day views of any kind of event |
| editor | lost-ui/editor | Notion-style block editor on Tiptap |
| charts | lost-ui/charts | data-driven charts on Recharts |
| effects | lost-ui/effects | landing-page effects (Magic UI) |
| templates | lost-ui/templates/<category>/<page> | whole pages and layouts, by category: auth, errors, backoffice. lost-ui/templates exports all of them |
| i18n | lost-ui/i18n | provider and hooks for en, es and pt |
One import is enough: import { Button, EventCalendar, LoginPage } from "lost-ui" gives every component and every template that needs no optional peer of its own, so you do not have to know the path of each. Charts (recharts) and the editor (Tiptap) need their peers for the whole layer, so they keep their own entries, lost-ui/charts and lost-ui/editor; a component with a peer of its own (the date picker, Toaster…) is imported by its path.
A component is a piece you place in a screen. A template is the screen, or the frame of one, and the app only gives it props and handlers. See docs/structure.md.
Install in a project
The package is public on npm as @danielsoaresf/lost-ui. Apps install it under the alias lost-ui, so every import reads lost-ui/... with no scope prefix. It needs React 19 and Tailwind CSS v4 in the app.
1. Install the package and the required peers
npm i "lost-ui@npm:@danielsoaresf/lost-ui"
npm i react react-dom tailwindcss tw-animate-css motion # skip what the app already hasnpm puts the package in node_modules/lost-ui, so TypeScript and the bundler resolve lost-ui/... with no extra config. The app's package.json keeps:
"lost-ui": "npm:@danielsoaresf/lost-ui@^0.3.0"Never run a plain npm i lost-ui: the unscoped name on npm is another package. Always install with the lost-ui@npm:@danielsoaresf/lost-ui form above.
Required peers: react and react-dom (19), tailwindcss (4), tw-animate-css and motion (13 or 14).
2. Install the optional peers of what you use
A component that needs an extra package imports it by its own path, so the app only installs what it uses:
| You use | Install |
| --------------------------------------------- | ------------------------------------------------ |
| App (lost-ui/app/app), Toaster, toast | sonner |
| any chart (lost-ui/charts) | recharts |
| the shadcn Form primitive | react-hook-form |
| Calendar, FormInputDate | react-day-picker |
| InputOTP, FormPinInput | input-otp |
| FormInputPhone, FormCountrySelect | libphonenumber-js, country-flag-icons |
| FormEmojiPicker | emoji-picker-react |
| Command, Drawer | cmdk, vaul |
| Resizable, Carousel | react-resizable-panels, embla-carousel-react |
The full list, with the effects that need cobe, shiki, react-tweet…, is in skills/lost-ui/references/setup.md.
3. Import the styles
In the main CSS file of the app (the one that has @import "tailwindcss"):
@import "tailwindcss";
@import "lost-ui/styles.css"; /* token mapping, no brand values */
@import "lost-ui/theme-neutral.css"; /* default values; leave out when the app defines its own */
@import "lost-ui/effects.css"; /* only if you use lost-ui/effects */styles.css already tells Tailwind to scan the library, so no @source line is needed. If the app uses @import "tailwindcss" source(none), check that the classes of the library still appear. Without theme-neutral.css, the app must define the tokens (--background, --primary, --radius…). Dark mode is the .dark class on an ancestor.
4. Wrap the app once
import { App } from "lost-ui/app/app"; // needs sonner
<App language="en">{/* router outlet */}</App>;App joins the language provider (en, es, pt), the tooltip provider and the toaster. Then import from the layers, for example lost-ui/ui, /elements, /forms, /data, /templates.
5. Check it works
Render a button and a template:
import { Button } from "lost-ui/ui";
import { NotFoundPage } from "lost-ui/templates";If a component shows without style, the CSS imports of step 3 are missing or the CSS file is not loaded. For TypeScript, use "moduleResolution": "bundler" (or node16/nodenext) in tsconfig.json, so the exports of the package are resolved. With Vite, if React appears twice (hook errors), add resolve.dedupe: ["react", "react-dom"].
Use it with Claude Code
The package ships a skill that teaches Claude Code the components and their props. Copy it into the app:
mkdir -p .claude/skills && cp -r node_modules/lost-ui/skills/lost-ui .claude/skills/On Windows PowerShell: Copy-Item -Recurse node_modules\lost-ui\skills\lost-ui .claude\skills\. Do it again after updating the library, so the skill has the current props.
Update
npm i "lost-ui@npm:@danielsoaresf/lost-ui@latest"Try a local build before publishing
# in lost-ui
npm install
npm run build
npm pack # danielsoaresf-lost-ui-<version>.tgz
# in the app
npm i "lost-ui@file:../lost-ui/danielsoaresf-lost-ui-<version>.tgz"Use
Use the components:
import { App } from "lost-ui/app/app"; // needs sonner
import { LoginPage } from "lost-ui/templates";
export function Login() {
return (
<App language="en">
<LoginPage
onSubmit={async ({ identifier, password }) => {
const error = await signIn(identifier, password);
return error; // a returned text is shown as the error of the form
}}
forgotPasswordHref="/recover-password"
registerHref="/register"
/>
</App>
);
}Navigation is router-agnostic: pass renderLink with the link of your router. Templates never fetch data or decide permissions; the app passes items and handlers.
Develop
| Command | Use |
| ------------------------- | ----------------------------------------------------------- |
| npm run storybook | Storybook on port 6006 |
| npm test | Vitest, all tests |
| npm run typecheck | tsc --noEmit |
| npm run build | library build and declarations |
| npm run build-storybook | static Storybook build |
| npm run barrels | regenerate the index.ts files of the layers (do not edit) |
| npm run skill | regenerate the API reference of the Claude Code skill |
| npm run format | Prettier |
Every component has a folder with the component, its stories and its tests (<name>.test.tsx). The rules are in CLAUDE.md and docs/component-conventions.md.
Documentation
- docs/README.md: map of the documents
- docs/structure.md: folders, templates, the internal layout
- docs/component-conventions.md: anatomy of a component, code rules, new-component checklist
- docs/stack.md: stack and decisions
- docs/forms.md, docs/charts.md, docs/i18n.md, docs/notifications.md
- docs/orchestrator.md: how Claude Code plans, delegates and validates work in this repository
- skills/lost-ui: Claude Code skill to build screens with the library in an app
License
MIT. The code imported from other projects keeps its own licence, see docs/THIRD_PARTY_NOTICES.md.
Credits
Built on shadcn/ui, Radix UI, Magic UI, Recharts and Motion; the element and data components follow Nuxt UI. Details in docs/THIRD_PARTY_NOTICES.md.
