🧩 Developer Handbook

Explore reusable UI components and layout patterns in the Getradg application.

Button Component

Buttons are used to trigger actions. Below are the available variants with their visual states.

Example usage:

import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/Icon";
export default function Example() {
  return (
    <div className="flex gap-4">
      <Button variant="primary">Primary</Button>
      <Button variant="secondary">Secondary</Button>
      <Button variant="destructive">Destructive</Button>
      <Button variant="muted" disabled>Disabled</Button>
      <Button variant="tertiary">Tertiary Example</Button>
      <Button variant="tertiary"> <Icon name="Star" /></Button>
    </div>
  );
}

Button Properties

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'destructive' | 'muted' | 'tertiary'"primary"The visual style of the button.
disabledbooleanfalseDisables the button, preventing any interaction.
2 properties
Accordion Component

Accordions group content and allow users to expand and collapse sections. Below is a simple example and the available props.

Default variant

Section One

Content for section one. Use accordions to hide optional or lengthy details.

Boxed variant

Title

Nested content for boxed variant — looks outlined and grouped.

Boxed variant (iconPosition="right") with extra right-side icon

Title with right icons

This boxed item shows an extra icon on the right, followed by the accordion chevron.

Example usage:

import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@/components/ui/accordion'

<Accordion type="single" defaultValue="item-1">
  <AccordionItem value="item-1">
    <AccordionTrigger>Section One</AccordionTrigger>
    <AccordionContent>Content for section one</AccordionContent>
  </AccordionItem>
</Accordion>

<Accordion variant="boxed" iconPosition="left" type="single" defaultValue="boxed-1">
  <AccordionItem value="boxed-1">
    <AccordionTrigger>Title</AccordionTrigger>
    <AccordionContent>Content for boxed item</AccordionContent>
  </AccordionItem>
</Accordion>

Accordion Properties

PropTypeDefaultDescription
type'single' | 'multiple''single'Accordion mode: single allows one open item, multiple allows many.
valuestring | string[]undefinedControlled open item(s) value(s).
defaultValuestring | string[]undefinedUncontrolled initial open item(s).
iconPosition'left' | 'right''right'Position of the chevron icon in the trigger (left or right).
4 properties
Icon Component

Icons enhance visual communication and can be used standalone or inside other components. Below are a few examples.

Example usage:


import { Button } from "@/components/ui/button";
import { Icon } from "../ui/Icon";
export default function Example() {
  return (
    <div className="flex gap-4">
    <Icon name="Star" size="lg" className="text-muted-foreground" />
      <Icon name="Check" size="lg" className="text-green-600" />
      <Icon name="X" size="lg" className="text-red-600" />
      <Button variant="primary">
        <Star className="w-4 h-4 mr-2" /> Star Button
      </Button>
    </div>
  );
}

Icon Properties

PropTypeDefaultDescription
sizestring | number"24"Width and height of the icon in pixels.
colorstring"currentColor"Color of the icon, accepts any valid CSS color.
2 properties
Combobox

A searchable combobox built from the project's Popover andCommand primitives. Supports controlled and uncontrolled usage and shows a check icon for the selected value.

Controlled

Selected: none

Uncontrolled

Example usage:

import Combobox from "@/components/ui/combobox";

const items = [ { value: "next.js", label: "Next.js" } ];

export default function Example() {
  const [value, setValue] = React.useState("");
  return (
    <Combobox items={items} value={value} onChange={setValue} />
  );
}

Combobox Properties

PropTypeDefaultDescription
itemsComboboxItem[][]Array of items with `value` and `label` to show in the list.
valuestringundefinedControlled value for selected item.
defaultValuestringundefinedUncontrolled initial value.
onChange(value: string) => voidundefinedChange handler called when selection changes.
4 properties
Avatar Component

The Avatar component displays a user's profile image or initials with an optional fallback.

JDSCAB

Example usage:

import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";

export default function Example() {
  return (
    <div className="flex gap-4">
      <Avatar>
  <AvatarImage src="/user-avatar.svg" alt="User avatar" />
        <AvatarFallback>JD</AvatarFallback>
      </Avatar>
    </div>
  );
}

Avatar Properties

PropTypeDefaultDescription
classNamestringundefinedApplies custom Tailwind CSS classes for styling the avatar container.
srcstringundefinedThe image URL for the avatar.
fallbackReactNodeundefinedFallback content shown when the image cannot load.
3 properties
Card Component

The Card component is a flexible container used to group content. Supports slots like CardHeader, CardContent, CardFooter, and CardAction.

Card Title
Action
Optional description text.
This is the main content of the card.
Footer content like buttons or metadata.

Example usage:

import {
  Card,
  CardHeader,
  CardTitle,
  CardDescription,
  CardContent,
  CardFooter,
  CardAction,
} from "@/components/ui/card";

export default function Example() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Card Title</CardTitle>
        <CardAction>Action</CardAction>
      </CardHeader>
      <CardDescription>Optional description text.</CardDescription>
      <CardContent>This is the main content of the card.</CardContent>
      <CardFooter>Footer content like buttons or metadata.</CardFooter>
    </Card>
  );
}

Card Properties

PropTypeDefaultDescription
classNamestring""Custom Tailwind classes for Card.
childrenReact.ReactNodeundefinedContent inside the Card.
2 properties
Form Dialog

Demonstrates a form placed inside the Dialog component. This mirrors a modal form pattern where users can create or edit items without leaving the current page.

Example usage:

import { Dialog, DialogTrigger, DialogContent } from "@/components/ui/dialog";
import { Form } from "@/components/ui/form";

<Dialog>
  <DialogTrigger>
    <Button>Open Form Dialog</Button>
  </DialogTrigger>
  <DialogContent>
    <Form {...form}>
      <form onSubmit={form.handleSubmit(onSubmit)}>
      </form>
    </Form>
  </DialogContent>
</Dialog>

Dialog Properties

PropTypeDefaultDescription
openbooleanfalseControls whether the dialog is open.
onOpenChange(open: boolean) => voidundefinedCallback fired when dialog open state changes.
asChildbooleanfalseIf true, renders the child element as the trigger without an extra wrapper.
childrenReact.ReactNodeundefinedDialog content, header, and footer elements.
4 properties
Pagination Component

The CustomPagination component provides an intuitive, theme-aware way to navigate through paginated datasets. It includes a page size dropdown and accessible navigation controls for flexible pagination handling.

Example usage:

import { CustomPagination } from "@/components/ui/custom-pagination";
import React from "react";

export default function Example() {
  const [page, setPage] = React.useState(1);
  const [pageSize, setPageSize] = React.useState(10);

  return (
    <CustomPagination
      total={100}
      page={page}
      pageSize={pageSize}
      onPageChange={setPage}
      onPageSizeChange={setPageSize}
    />
  );
}

Pagination Properties

PropTypeDefaultDescription
totalnumber0Total number of items to paginate.
pagenumber1Current page number (1-based index).
pageSizenumber10Number of items displayed per page.
onPageChange(page: number) => void() => {}Callback triggered when page number changes.
onPageSizeChange(size: number) => void() => {}Callback triggered when page size changes.
pageSizeOptionsnumber[][10, 25, 50, 100]Available options for items per page dropdown.
classNamestring""Optional custom className for layout overrides.
7 properties
Form Component

The Form component is a wrapper around React Hook Form integrated with ShadCN UI styling. It standardizes form layout, validation, and accessibility using reusable UI elements like Input and Select.

Example usage:

import { Form, FormField, FormItem, FormLabel, FormControl } from "@/components/ui/form";
import { Input } from "@/components/ui/input";

<Form {...form}>
  <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
    <FormField
      control={form.control}
      name="title"
      render={({ field }) => (
        <FormItem>
          <FormLabel>Title</FormLabel>
          <FormControl>
            <Input placeholder="Enter title..." {...field} />
          </FormControl>
        </FormItem>
      )}
    />
  </form>
</Form>

Form Properties

PropTypeDefaultDescription
controlControl<z.infer<typeof formSchema>>RequiredReact Hook Form control object used for field management.
namestringundefinedUnique name key that identifies the field in the form schema.
render({ field }) => React.ReactNodeRequiredRender prop function for each form field element.
onSubmit(values: T) => voidundefinedCallback executed when form is submitted successfully.
4 properties
Table Component

The DataTable component provides a reusable, theme-aware table with built-in pagination and selection support. Define dynamic columns and easily map row data.

Filter table results in real-time by user name.
Alicealice@example.comAdminActive
Bobbob@example.comManagerInactive
Charliecharlie@example.comUserActive
Daviddavid@example.comUserActive
Emmaemma@example.comViewerInactive

Example usage:

import { DataTable } from "@/components/ui/table";

const columns = [
  { key: "name", header: "Name" },
  { key: "email", header: "Email" },
  { key: "role", header: "Role" },
  { key: "status", header: "Status", render: (r) => r.status }
];

<DataTable columns={columns} data={usersArray} pageSize={5} />;

Table Properties

PropTypeDefaultDescription
columnsColumn[][]Array of column definitions: { key, header, render?, className? }
dataany[][]Array of row objects to display in the table.
pageSizenumber5Number of rows per page.
classNamestring""Optional wrapper className for layout customization.
4 properties
Label Component

The Label component provides accessible text for form elements. It automatically adapts its color when the related input is focused or invalid, and can also represent visual states like default, focus, danger, and muted.

(neutral)

(active / focus state)

(error / invalid state)

(optional)

This is a helper text

This is an error helper text

Example usage:

import { Label } from "@/components/ui/label";

<Label>Default Label</Label>
<Label className="text-blue-600">Focus Label</Label>
<Label className="text-red-600">Danger Label</Label>
<Label className="text-muted-foreground">Title (optional)</Label>

<p className="text-xs text-gray-500">Helper text</p>
<p className="text-xs text-red-500">Error helper text</p>

Label Properties

PropTypeDefaultDescription
childrenReact.ReactNodeundefinedLabel text or node content displayed within the label.
htmlForstringundefinedAssociates the label with a form control via its ID.
classNamestring""Optional custom class for overriding styles.
3 properties
Input Component

The Input component is a styled input field that supports various states such as default, focused, invalid, disabled, and clearable. It uses ShadCN’s design tokens for consistent color, radius, and border behaviors.

Example usage:

import { Input } from "@/components/ui/input";
              import Icon from "@/components/ui/Icon";

<Input placeholder="Suggestion..." />

<Input aria-invalid="true" placeholder="Invalid input" />

<Input placeholder="Suggestion..." disabled />

<div className="relative">
  <Input placeholder="Input" className="pr-8" />
  <Icon name="X" size="sm" className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground cursor-pointer hover:text-foreground transition-colors" />
</div>

Input Properties

PropTypeDefaultDescription
typestring"text"Defines the input type such as text, email, password, etc.
classNamestring""Optional custom className to override styles.
disabledbooleanfalseDisables user interaction with the input field.
aria-invalidbooleanfalseApplies red border and destructive ring for invalid state.
placeholderstring""Text hint displayed when the input is empty.
5 properties
Textarea Component

The Textarea component provides a multi-line input field supporting focus, invalid, disabled, and character count states — styled for consistency with ShadCN’s design tokens.

0/100
18/100
13/100
17/100
0/100

Example usage:

import { Textarea } from "@/components/ui/textarea";

<Textarea placeholder="Suggestion..." showCount maxLength={100} />

<Textarea aria-invalid={true} value="Input" showCount readOnly />

<Textarea placeholder="Disabled..." disabled showCount maxLength={100} />

Textarea Properties

PropTypeDefaultDescription
showCountbooleanfalseDisplays character count at the bottom-right corner.
maxLengthnumber100Sets maximum allowed characters.
aria-invalidbooleanfalseApplies error border for invalid state.
disabledbooleanfalsePrevents user interaction when true.
readOnlybooleanfalseMakes the textarea non-editable but still selectable.
5 properties
Checkbox

Checkbox states: default, hover, checked, indeterminate, disabled.

Default
Hover
Checked
Indeterminate
ReadOnly
Disabled

Example usage:

import { Checkbox } from "@/components/ui/checkbox";

<Checkbox />

<Checkbox defaultChecked />

<Checkbox disabled />

Checkbox Properties

PropTypeDefaultDescription
defaultCheckedbooleanfalseMarks the checkbox as checked by default.
disabledbooleanfalseDisables user interaction.
2 properties
Radio Button

The RadioGroup component provides an accessible, themed way to render a list of radio options. It supports interactive states like default, hover, focus, selected, read-only, and disabled.

Example usage:

import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";

<RadioGroup>
  <label className="flex items-center gap-3">
    <RadioGroupItem value="1" />
    <span>Option</span>
  </label>
</RadioGroup>

Radio Properties

PropTypeDefaultDescription
valuestring""Defines the radio item’s value within a group.
disabledbooleanfalseDisables the radio item and prevents user interaction.
idstringundefinedOptional ID used to associate the radio with a label.
classNamestring""Optional custom className for additional styling.
4 properties
Common Tabs Component

The CommonTabs set provides a reusable, theme-safe tabs UI (underline style) composed with Radix + ShadCN tokens. Use the low-level parts for full control or the array-driven CommonSimpleTabs for quick setups.

Make changes to your account here.
Account panel (array-driven).

Example usage (Manual composition):

import {
  CommonTabsRoot as TabsRoot,
  CommonTabsList as TabsList,
  CommonTabsTrigger as TabsTrigger,
  CommonTabsContent as TabsContent,
} from "@/components/ui/common-tabs";

export default function ManualTabsDemo() {
  return (
    <TabsRoot defaultValue="account" className="w-full">
      <TabsList>
        <TabsTrigger value="account">Account</TabsTrigger>
        <TabsTrigger value="password">Password</TabsTrigger>
      </TabsList>

      <TabsContent value="account">
        Make changes to your account here.
      </TabsContent>
      <TabsContent value="password">
        Change your password here.
      </TabsContent>
    </TabsRoot>
  );
}

Example usage (Array-driven):

import { CommonSimpleTabs } from "@/components/ui/common-tabs";

export default function SimpleTabsDemo() {
  return (
    <CommonSimpleTabs
      defaultValue="account"
      items={[
        { value: "account", label: "Account", content: "Make changes to your account here." },
        { value: "password", label: "Password", content: "Change your password here." },
      ]}
    />
  );
}

Common Tabs Properties

PropTypeDefaultDescription
items{ value: string; label: ReactNode; content: ReactNode; triggerClassName?: string }[]—Array-driven tabs (for <CommonSimpleTabs>).
defaultValuestringitems[0]?.valueInitial active tab (uncontrolled).
valuestring—Controlled active tab value.
onValueChange(v: string) => void—Callback when tab changes.
classNamestring""Additional classes for root/list/trigger/content.
listClassNamestring""Extra classes for the tabs list (SimpleTabs only).
triggerClassNamestring""Extra classes for each trigger (SimpleTabs only).
contentClassNamestring""Extra classes for content panels (SimpleTabs only).
8 properties
Option Dropdown

The dropdown supports both DropdownOptionItem (simple or with icon) and DropdownOptionCheckboxItem (with checkbox column) options, with optional subtext for additional context.

Without subtext

With subtext

Example usage:

import * as React from "react";
import { Button } from "@/components/ui/button";
import {
  DropdownMenu,
  DropdownMenuTrigger,
  DropdownMenuContent,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownOptionItem,
  DropdownOptionCheckboxItem,
} from "@/components/ui/dropdown-menu";
import { Icon } from "../ui/Icon";
export default function Example() {
  const [selectedId, setSelectedId] = React.useState("opt-2");
  const [checked, setChecked] = React.useState<Record<string, boolean>>({ "chk-1": true });

  return (
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <Button variant="secondary" className="w-56 justify-between">
          Open dropdown
        </Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-64">
        <DropdownMenuLabel>Options</DropdownMenuLabel>
        <DropdownMenuSeparator />
        <DropdownOptionItem
          selected={selectedId === "opt-1"}
          onSelect={(e) => { e.preventDefault(); setSelectedId("opt-1"); }}
        >
          Option
        </DropdownOptionItem>
        <DropdownOptionItem
          iconLeft={<Icon name="Star" size="sm" />}
          selected={selectedId === "opt-2"}
          onSelect={(e) => { e.preventDefault(); setSelectedId("opt-2"); }}
        >
          Option
        </DropdownOptionItem>
        <DropdownOptionCheckboxItem
          checked={!!checked["chk-1"]}
          onCheckedChange={(next) => setChecked(p => ({ ...p, "chk-1": !!next }))}
        >
          Option
        </DropdownOptionCheckboxItem>
        <DropdownOptionItem subtext="Subtext">Option</DropdownOptionItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}

Dropdown Properties

PropTypeDefaultDescription
selectedbooleanfalseIndicates if the dropdown option is currently selected.
iconLeftReactNodeundefinedOptional icon displayed to the left of the option label.
subtextstringundefinedOptional subtext displayed below the option label.
checkedbooleanfalseFor checkbox items, controls whether the option is checked.
4 properties