andibase

UI Components

Shared UI components available from @andibase/ui for workspace apps

Open Markdown

@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 pathProvidesNotes
@andibase/ui/accordionAccordion, AccordionContent, AccordionItem, AccordionTriggerCollapsible content sections
@andibase/ui/alertAlert, AlertDescription, AlertTitleInline status and notice blocks
@andibase/ui/alert-dialogAlertDialog familyDestructive and confirmation dialogs
@andibase/ui/aspect-ratioAspectRatioFixed-ratio media container
@andibase/ui/avatarAvatar, AvatarFallback, AvatarImageUser and entity avatars
@andibase/ui/badgeBadgeCompact labels and status markers
@andibase/ui/breadcrumbBreadcrumb familyBreadcrumb navigation
@andibase/ui/buttonButton, buttonVariantsPrimary action control
@andibase/ui/button-groupButtonGroupGrouped button layouts
@andibase/ui/calendarCalendarDate picker calendar UI
@andibase/ui/cardCard familyStructured content containers
@andibase/ui/carouselCarousel familyHorizontal carousel layouts
@andibase/ui/chartChartContainer and chart helpersShared chart wrappers
@andibase/ui/checkboxCheckboxBoolean form control
@andibase/ui/collapsibleCollapsible familyExpand and collapse content
@andibase/ui/comboboxComboboxSearchable select-style input
@andibase/ui/commandCommand familyCommand palette and searchable lists
@andibase/ui/context-menuContextMenu familyRight-click and contextual menus
@andibase/ui/dialogDialog familyModal dialogs
@andibase/ui/drawerDrawer familySlide-up or slide-in panels
@andibase/ui/dropdown-menuDropdownMenu familyTriggered menu popovers
@andibase/ui/emptyEmptyEmpty-state placeholder
@andibase/ui/fieldField familyForm field composition helpers
@andibase/ui/file-uploadFileUploadUpload a file to a workspace path or create a new text file
@andibase/ui/hover-cardHoverCard familyRich hover previews
@andibase/ui/inputInputSingle-line text input
@andibase/ui/input-groupInputGroup familyGrouped input layouts
@andibase/ui/input-otpInputOTP familyOne-time password input
@andibase/ui/itemItemReusable item row layout
@andibase/ui/kbdKbdKeyboard shortcut label
@andibase/ui/labelLabelForm labels
@andibase/ui/linkLinkStyled link component
@andibase/ui/menubarMenubar familyApp-style menu bars
@andibase/ui/navigation-menuNavigationMenu familyStructured navigation menus
@andibase/ui/paginationPagination familyPage navigation controls
@andibase/ui/pagination-bar-skeletonPaginationBarSkeletonLoading state for pagination
@andibase/ui/popoverPopover familyFloating popover surfaces
@andibase/ui/progressProgressProgress indicator
@andibase/ui/radio-groupRadioGroup, RadioGroupItemSingle-choice form control
@andibase/ui/resizableResizablePanelGroup familyResizable panel layouts
@andibase/ui/scroll-areaScrollArea, ScrollBarCustom scroll containers
@andibase/ui/selectSelect familySelect dropdown input
@andibase/ui/separatorSeparatorVisual section separator
@andibase/ui/sheetSheet familySide sheets and slide-over panels
@andibase/ui/sidebarSidebar familyApplication sidebar primitives
@andibase/ui/skeletonSkeletonLoading placeholders
@andibase/ui/sliderSliderRange and value slider
@andibase/ui/sonnerToaster, toastToast notifications
@andibase/ui/spinnerSpinnerLoading spinner
@andibase/ui/switchSwitchToggle switch control
@andibase/ui/tableTable familyTabular data layouts
@andibase/ui/table-skeletonTableSkeletonLoading state for tables
@andibase/ui/tabsTabs, TabsContent, TabsList, TabsTriggerTabbed interfaces
@andibase/ui/textareaTextareaMultiline text input
@andibase/ui/toggleToggleTwo-state pressed control
@andibase/ui/toggle-groupToggleGroup, ToggleGroupItemGrouped toggles
@andibase/ui/tooltipTooltip familyHover and focus tooltips

Shared helpers

In addition to UI components, the package also exports shared helpers:

Import pathProvidesNotes
@andibase/ui/lib/utilscnShared class name utility
@andibase/ui/hooks/use-mobileuseIsMobileMobile 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

PropTypeDefaultNotes
mode"both" | "upload" | "new""both"Simplest way to control which flows are shown
pathstringundefinedFixed workspace-relative path. When set, the path input becomes read-only UI
defaultPathstringundefinedInitial editable path value
defaultNewFileContentstring""Initial content for the new-file textarea
acceptstringundefinedNative file input accept filter
headingReactNode"Files"Card title
descriptionReactNodebuilt-in textCard description
metadataRecord<string, string>undefinedExtra metadata sent to the file API
onSuccess(result) => voidundefinedCalled after upload or file creation succeeds
onError(error) => voidundefinedCalled when the request fails
request(path, init) => Promise<Response>embedded app fetch or fetchOverride 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,
      },
    })
  }
/>

On this page