UI Components
Shared UI components available from @andibase/ui for workspace apps
@andibase/ui is the shared component package available inside the app runtime. It exposes shared components derived from shadcn/ui, so workspace apps can reuse the same primitives and patterns instead of redefining UI from scratch.
For the upstream component patterns and usage guidance, see the official shadcn/ui components documentation.
You can import either from the package root:
import { Button, Card, Input } from "@andibase/ui";Or from subpaths:
import { Button } from "@andibase/ui/button";
import { Input } from "@andibase/ui/input";Available components
| Import path | Provides | Notes |
|---|---|---|
@andibase/ui/accordion | Accordion, AccordionContent, AccordionItem, AccordionTrigger | Collapsible content sections |
@andibase/ui/alert | Alert, AlertDescription, AlertTitle | Inline status and notice blocks |
@andibase/ui/alert-dialog | AlertDialog family | Destructive and confirmation dialogs |
@andibase/ui/aspect-ratio | AspectRatio | Fixed-ratio media container |
@andibase/ui/avatar | Avatar, AvatarFallback, AvatarImage | User and entity avatars |
@andibase/ui/badge | Badge | Compact labels and status markers |
@andibase/ui/breadcrumb | Breadcrumb family | Breadcrumb navigation |
@andibase/ui/button | Button, buttonVariants | Primary action control |
@andibase/ui/button-group | ButtonGroup | Grouped button layouts |
@andibase/ui/calendar | Calendar | Date picker calendar UI |
@andibase/ui/card | Card family | Structured content containers |
@andibase/ui/carousel | Carousel family | Horizontal carousel layouts |
@andibase/ui/chart | ChartContainer and chart helpers | Shared chart wrappers |
@andibase/ui/checkbox | Checkbox | Boolean form control |
@andibase/ui/collapsible | Collapsible family | Expand and collapse content |
@andibase/ui/combobox | Combobox | Searchable select-style input |
@andibase/ui/command | Command family | Command palette and searchable lists |
@andibase/ui/context-menu | ContextMenu family | Right-click and contextual menus |
@andibase/ui/dialog | Dialog family | Modal dialogs |
@andibase/ui/drawer | Drawer family | Slide-up or slide-in panels |
@andibase/ui/dropdown-menu | DropdownMenu family | Triggered menu popovers |
@andibase/ui/empty | Empty | Empty-state placeholder |
@andibase/ui/field | Field family | Form field composition helpers |
@andibase/ui/file-upload | FileUpload | Upload a file to a workspace path or create a new text file |
@andibase/ui/hover-card | HoverCard family | Rich hover previews |
@andibase/ui/input | Input | Single-line text input |
@andibase/ui/input-group | InputGroup family | Grouped input layouts |
@andibase/ui/input-otp | InputOTP family | One-time password input |
@andibase/ui/item | Item | Reusable item row layout |
@andibase/ui/kbd | Kbd | Keyboard shortcut label |
@andibase/ui/label | Label | Form labels |
@andibase/ui/link | Link | Styled link component |
@andibase/ui/menubar | Menubar family | App-style menu bars |
@andibase/ui/navigation-menu | NavigationMenu family | Structured navigation menus |
@andibase/ui/pagination | Pagination family | Page navigation controls |
@andibase/ui/pagination-bar-skeleton | PaginationBarSkeleton | Loading state for pagination |
@andibase/ui/popover | Popover family | Floating popover surfaces |
@andibase/ui/progress | Progress | Progress indicator |
@andibase/ui/radio-group | RadioGroup, RadioGroupItem | Single-choice form control |
@andibase/ui/resizable | ResizablePanelGroup family | Resizable panel layouts |
@andibase/ui/scroll-area | ScrollArea, ScrollBar | Custom scroll containers |
@andibase/ui/select | Select family | Select dropdown input |
@andibase/ui/separator | Separator | Visual section separator |
@andibase/ui/sheet | Sheet family | Side sheets and slide-over panels |
@andibase/ui/sidebar | Sidebar family | Application sidebar primitives |
@andibase/ui/skeleton | Skeleton | Loading placeholders |
@andibase/ui/slider | Slider | Range and value slider |
@andibase/ui/sonner | Toaster, toast | Toast notifications |
@andibase/ui/spinner | Spinner | Loading spinner |
@andibase/ui/switch | Switch | Toggle switch control |
@andibase/ui/table | Table family | Tabular data layouts |
@andibase/ui/table-skeleton | TableSkeleton | Loading state for tables |
@andibase/ui/tabs | Tabs, TabsContent, TabsList, TabsTrigger | Tabbed interfaces |
@andibase/ui/textarea | Textarea | Multiline text input |
@andibase/ui/toggle | Toggle | Two-state pressed control |
@andibase/ui/toggle-group | ToggleGroup, ToggleGroupItem | Grouped toggles |
@andibase/ui/tooltip | Tooltip family | Hover and focus tooltips |
Shared helpers
In addition to UI components, the package also exports shared helpers:
| Import path | Provides | Notes |
|---|---|---|
@andibase/ui/lib/utils | cn | Shared class name utility |
@andibase/ui/hooks/use-mobile | useIsMobile | Mobile breakpoint hook |
FileUpload
FileUpload is a ready-to-use workspace file input for embedded apps.
It handles:
- direct file uploads through the workspace file API
- creating a new text or markdown file
- optional fixed paths when the app should save to one exact location
- embedded auth automatically through
window.andibase.fetch(...)
Import
import { FileUpload } from "@andibase/ui/file-upload";Simplest usage
export default function App() {
return <FileUpload />;
}Common patterns
Upload or create:
<FileUpload mode="both" />Upload only:
<FileUpload mode="upload" />Create only:
<FileUpload mode="new" />Fixed workspace path:
<FileUpload mode="upload" path="imports/customers.csv" />Default editable path:
<FileUpload defaultPath="notes/today.md" />Useful props
| Prop | Type | Default | Notes |
|---|---|---|---|
mode | "both" | "upload" | "new" | "both" | Simplest way to control which flows are shown |
path | string | undefined | Fixed workspace-relative path. When set, the path input becomes read-only UI |
defaultPath | string | undefined | Initial editable path value |
defaultNewFileContent | string | "" | Initial content for the new-file textarea |
accept | string | undefined | Native file input accept filter |
heading | ReactNode | "Files" | Card title |
description | ReactNode | built-in text | Card description |
metadata | Record<string, string> | undefined | Extra metadata sent to the file API |
onSuccess | (result) => void | undefined | Called after upload or file creation succeeds |
onError | (error) => void | undefined | Called when the request fails |
request | (path, init) => Promise<Response> | embedded app fetch or fetch | Override only when using the component outside the embedded app runtime |
Result object
onSuccess receives:
{
action: "upload" | "new";
path: string;
file: {
id: string;
name: string;
path: string;
contentType?: string | null;
sizeBytes?: number | null;
};
}Outside embedded apps
If you use the component outside the custom app iframe runtime, pass a request function that adds the right auth and headers for your environment.
<FileUpload
request={(path, init) =>
fetch(path, {
...init,
credentials: "include",
headers: {
...init?.headers,
"x-workspace-handle": workspaceHandle,
},
})
}
/>