- Accordion
- Attachment
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Card
- Checkbox
- Code Block
- Collapsible
- Dialog
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Label
- Marker
- Message
- Number Flow
- Pagination
- Popover
- Progress
- Radio Group
- Select
- Slider
- Sonner
- Spinner
- Switch
- Tooltip
- Separator
- Sheet
- Tabs
- Textarea
- Toggle
- Toggle Group
- Trace
Frakment components ship as TypeScript. To use them in a plain JavaScript project, strip type annotations after install. This page covers which patterns to strip, how to strip them, and what stays.
Prerequisites
- A JavaScript project (
.jsx/.js) - React 19
- Tailwind CSS v4
Setup
Run init and add a component as usual:
$ bunx --bun frakment@latest init npx frakment@latest add button$ npx frakment@latest init npx frakment@latest add button$ pnpm dlx frakment@latest init npx frakment@latest add button$ yarn dlx frakment@latest init npx frakment@latest add button
The CLI writes .tsx. Rename to .jsx and strip types.
Stripping types
Frakment uses four TypeScript patterns. Remove them in this order:
| Pattern | Strip to |
|---|---|
interface Props { ... } | Delete the entire block |
(props: Props) | (props) |
React.ComponentProps<"div"> | {} (empty object) |
as const | Delete as const |
Example
A typical Frakment component has a props interface, a ComponentProps generic, and a cva call. Strip all three:
interface ButtonProps extends React.ComponentProps<"button"> {
variant?: "default" | "outline";
size?: "sm" | "md";
}
export function Button({ variant = "default", size = "md", ...props }: ButtonProps) {
return <button data-variant={variant} data-size={size} {...props} />;
}export function Button({ variant = "default", size = "md", ...props }) {
return <button data-variant={variant} data-size={size} {...props} />;
}Components with more types
Compound components use more patterns. Here is a Dialog example. The first snippet is the typed source; the second is the same component with JavaScript types stripped.
TypeScript:
function DialogContent({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content>) {
return <DialogPrimitive.Content className={className} {...props} />;
}JavaScript:
function DialogContent({ className, ...props }) {
return <DialogPrimitive.Content className={className} {...props} />;
}export function Button({ variant = "default", size = "md", ...props }) {
return <button data-variant={variant} data-size={size} {...props} />;
}Components with more types
Compound components use more patterns. Here is a Dialog example:
TypeScript:
function DialogContent({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content>) {
return <DialogPrimitive.Content className={className} {...props} />;
}JavaScript:
function DialogContent({ className, ...props }) {
return <DialogPrimitive.Content className={className} {...props} />;
}Engine packages
@frakment/ai ships compiled JavaScript with .d.ts types. They work in JS projects without any changes. Keep the .d.ts files — your editor uses them for hints even in a JS project.
Common errors
A type annotation is still present. Search for : React. and : Props in the .jsx file.
class-variance-authority exports VariantProps as a type only. In JavaScript, remove the import and the type annotation. cva() itself works in JS.
Best practices
- Keep
.d.tsfiles. Import them for editor hints even in JS projects. - Do not edit installed TSX in place. Copy to
.jsxfirst, then edit. - Upgrade carefully. Re-running
npx frakment addwrites.tsxagain — keep your.jsxin sync or run the CLI with--overwritecarefully.
Next
- Manual installation - step-by-step setup
- Theming - token reference
- Components - browse the catalog