BTST

Standalone Components

Use BTST's UI components independently of any plugin — auto-form, Markdown reader/editor, form builder, selects, and empty states.

BTST ships a set of UI components that can be used without setting up any plugin. Install the optional @btst/components package and import the APIs you use. It does not require @btst/stack or a feature plugin.

pnpm add @btst/components@1.0.0 react react-dom react-hook-form zod tailwindcss

Keep one React Hook Form and Zod installation in your application when supplying custom form fields or schemas. They are peer dependencies so your custom fields use the same form context and schema types as these components.

Configure Tailwind to scan the package's compiled modules. The path is relative to your stylesheet; adjust the example for its location:

@source "../node_modules/@btst/components/dist/**/*.{mjs,cjs}";

Import @btst/components/markdown/css when using the Markdown reader or editor. The stylesheet includes their existing themes and rendering styles. Components remain available as ESM and CommonJS entries with matching type declarations.

Applications migrating the old @btst/stack/ui/css import use @btst/components/ui/css. This separate stylesheet preserves the UI theme, light/dark variables and Tailwind setup, and scans the package's emitted modules. Import it only when choosing that theme; Markdown reader/editor styles remain available separately at @btst/components/markdown/css.

Markdown includes CSS and browser editor dependencies, so use a browser bundler. Milkdown Kit 7.23 publishes ESM-only subpaths that Crepe also loads from its CommonJS build. When bundling CommonJS Markdown, configure the bundler to accept import conditions for those dependencies (for example, Vite's resolve.conditions: ["module", "browser", "production", "import"]). Native Node require() cannot load the Markdown stylesheet or those ESM-only subpaths.

To explicitly bundle the CommonJS entries in Vite while accepting those ESM dependencies, resolve the entries through require before applying the condition:

import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const entries = [
  "markdown", "auto-form", "stepped-auto-form", "form-builder",
  "multi-select", "search-select", "empty",
];

export default {
  resolve: {
    conditions: ["module", "browser", "production", "import"],
    alias: entries.map((entry) => ({
      find: new RegExp(`^@btst/components/${entry}$`),
      replacement: require.resolve(`@btst/components/${entry}`),
    })),
  },
};
Import pathCSS exportWhat you get
@btst/components/auto-form—AutoForm, AutoFormSubmit
@btst/components/stepped-auto-form—SteppedAutoForm
@btst/components/form-builder—FormBuilder and schema helpers
@btst/components/markdown@btst/components/markdown/cssMarkdownContent, MarkdownEditor
@btst/components/multi-select—MultipleSelector
@btst/components/search-select—SearchSelect
@btst/components/empty—Empty, EmptyHeader, EmptyTitle, …

AutoForm

Generate forms automatically from Zod schemas. Learn more →

import { AutoForm, AutoFormSubmit } from "@btst/components/auto-form"
import type { FieldConfig, Dependency } from "@btst/components/auto-form"
<AutoForm
  formSchema={z.object({
    name: z.string().min(1),
    email: z.string().email(),
  })}
  onSubmit={(values) => console.log(values)}
>
  <AutoFormSubmit>Submit</AutoFormSubmit>
</AutoForm>

Stepped AutoForm

Multi-step wizard variant. Learn more →

import { SteppedAutoForm } from "@btst/components/stepped-auto-form"
import type { SteppedAutoFormProps, StepperComponentProps } from "@btst/components/stepped-auto-form"

FormBuilder

A JSON-schema-driven form editor — lets users visually create form definitions that can be stored and later rendered. Learn more →

import {
  FormBuilder,
  defaultComponents,
  objectFieldDefinition,
  arrayFieldDefinition,
  defineComponent,
  baseMetaSchema,
  baseMetaSchemaWithPlaceholder,
} from "@btst/components/form-builder"
import type {
  FormBuilderComponentDefinition,
  FormBuilderField,
  JSONSchema,
  JSONSchemaProperty,
} from "@btst/components/form-builder"
<FormBuilder
  value={currentSchema}
  onChange={(schema) => setSchema(schema)}
  components={defaultComponents}
/>

The full Form Builder plugin (@btst/plugin-form-builder) layers data persistence, API routes, and submissions on top of this component. Use the standalone import when you want to manage your own storage.


Markdown

MarkdownContent

Renders Markdown/MDX to HTML with syntax highlighting:

import { MarkdownContent } from "@btst/components/markdown"
import type { MarkdownContentProps } from "@btst/components/markdown"
<MarkdownContent content="# Hello\n\nSome **bold** text." />

Import the stylesheet in your root CSS (or layout):

@import "@btst/components/markdown/css";

MarkdownEditor

A rich Markdown editor powered by Milkdown/Crepe with optional image upload:

import { MarkdownEditor } from "@btst/components/markdown"
import type { MarkdownEditorProps } from "@btst/components/markdown"
<MarkdownEditor
  value={content}
  onChange={(markdown) => setContent(markdown)}
  placeholder="Write something..."
  uploadImage={async (file) => {
    const url = await uploadToStorage(file)
    return url
  }}
/>

MarkdownEditor Props

PropTypeDefaultDescription
valuestring""Current Markdown content
onChange(markdown: string) => void—Called on every change
classNamestring—Additional CSS classes
placeholderstring"Write something..."Placeholder when empty
uploadImage(file: File) => Promise<string>—Enables image upload; must return the public URL

The stylesheet also covers the Markdown editor. Import once from @btst/components/markdown/css.


MultipleSelector

A multi-select combobox with search, async options, and tag-style values:

import { MultipleSelector } from "@btst/components/multi-select"
import type { Option, MultipleSelectorRef } from "@btst/components/multi-select"
const options: Option[] = [
  { value: "react", label: "React" },
  { value: "vue", label: "Vue" },
  { value: "svelte", label: "Svelte" },
]

<MultipleSelector
  options={options}
  value={selected}
  onChange={setSelected}
  placeholder="Select frameworks..."
/>

SearchSelect

A searchable single-value select powered by Radix + cmdk:

import { SearchSelect } from "@btst/components/search-select"
<SearchSelect
  options={[
    { value: "us", label: "United States" },
    { value: "gb", label: "United Kingdom" },
  ]}
  value={country}
  onValueChange={setCountry}
  placeholder="Select a country..."
/>

Empty

Composable empty-state UI components:

import {
  Empty,
  EmptyHeader,
  EmptyTitle,
  EmptyDescription,
  EmptyContent,
  EmptyMedia,
} from "@btst/components/empty"
<Empty>
  <EmptyMedia>
    <InboxIcon className="size-12 text-muted-foreground" />
  </EmptyMedia>
  <EmptyHeader>
    <EmptyTitle>No results</EmptyTitle>
    <EmptyDescription>Try adjusting your search or filters.</EmptyDescription>
  </EmptyHeader>
  <EmptyContent>
    <Button>Clear filters</Button>
  </EmptyContent>
</Empty>