Files
formbricks/packages/survey-ui
Dhruwang Jariwala beb9a4ef06 chore: UI package components (#6929)
Co-authored-by: Matti Nannt <matti@formbricks.com>
2025-12-05 14:07:27 +05:30
..
2025-12-05 14:07:27 +05:30
2025-12-03 09:52:12 +05:30
2025-12-03 09:52:12 +05:30
2025-12-03 09:52:12 +05:30
2025-12-03 09:52:12 +05:30

@formbricks/survey-ui

Reusable UI components package for Formbricks applications.

Installation

This package is part of the Formbricks monorepo and is available as a workspace dependency.

Usage

import { Button } from "@formbricks/survey-ui";

function MyComponent() {
  return (
    <Button variant="default" size="default">
      Click me
    </Button>
  );
}

Development

# Build the package
pnpm build

# Watch mode for development
pnpm dev


# Lint
pnpm lint

Structure

src/
├── components/     # React components
├── lib/           # Utility functions
└── index.ts       # Main entry point

Adding New Components

This package is configured to work with shadcn/ui CLI. You can add components using:

cd packages/survey-ui
pnpm ui:add <component-name>

Important: After adding a component, reorganize it into a folder structure:

For example:

pnpm ui:add button
pnpm ui:organize button

Then export the component from src/components/index.ts.

Manual Component Creation

  1. Create a new component directory under src/components/<component-name>/
  2. Create index.tsx inside that directory
  3. Export the component from src/components/index.ts
  4. The component will be available from the main package export

Component Structure

Components follow this folder structure:

src/components/
├── button.tsx
├── button.stories.tsx

Theming

This package uses CSS variables for theming. The theme can be customized by modifying src/styles/globals.css.

Both light and dark modes are supported out of the box.