Skip to main content

Documentation Index

Fetch the complete documentation index at: https://araf.badr.co.id/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Table is used to display structured data in rows and columns. The component is composed of Cell elements that can be freely combined — each column can use a different cell style depending on the type of data being displayed.
Name ↓StatusRevenue ↓Progress
Iqbal Maulana
● Active$1,800↑ 20%60%DeleteEdit
Siti Nurhaliza
● Inactive$940↓ 8%28%DeleteEdit
Budi Santoso
● Pending$2,400↑ 35%85%DeleteEdit

Installation

npm install @araf-ds/core

Usage

import { Table, TableHeader, TableBody, TableRow, TableCell } from "@araf-ds/core";

export default function UsersTable() {
  return (
    <Table>
      <TableHeader>
        <TableRow>
          <TableCell type="header" style="white-header" sortable>Name</TableCell>
          <TableCell type="header" style="white-header">Status</TableCell>
          <TableCell type="header" style="white-header" sortable>Revenue</TableCell>
          <TableCell type="header" style="white-header">Progress</TableCell>
          <TableCell type="header" style="white-header" />
        </TableRow>
      </TableHeader>
      <TableBody>
        {users.map((user) => (
          <TableRow key={user.id}>
            <TableCell style="lead-checkbox" checkbox supportingText>
              {user.name}
              <TableCell.Supporting>{user.email}</TableCell.Supporting>
            </TableCell>
            <TableCell style="badge">{user.status}</TableCell>
            <TableCell style="trend-positive" value={user.revenue} change={user.change} />
            <TableCell style="progress-bar" value={user.progress} />
            <TableCell style="action-buttons">
              <TableCell.Action variant="danger">Delete</TableCell.Action>
              <TableCell.Action variant="primary">Edit</TableCell.Action>
            </TableCell>
          </TableRow>
        ))}
      </TableBody>
    </Table>
  );
}
The header row uses Type=Header with two background style options.
White background (#FFFFFF), used for tables with light contrast.
Name ↓RoleStatus
Olivia RhyeProduct DesignerActiveEdit
TokenValue
Background#FFFFFF
Text#667085
FontInter Medium 12px
Border bottom1px solid #EAECF0
<TableCell type="header" style="white-header" sortable>Name</TableCell>

Cell Styles

Each content cell (Type=Default) can use various styles depending on the type of data it displays.

Lead Cells

Cells with interactive elements (checkbox/toggle) and an optional avatar, icon, or payment logo on the left side.
StylePreview
Lead checkbox
Iqbal Maulana
Lead toggle
Iqbal Maulana
Lead avatar checkboxIM
Iqbal Maulana
Lead icon checkbox🏷️
Category A
subcategory
Lead payment method checkboxVISA
Visa •••• 4242
Expires 04/27
// Lead checkbox with supporting text
<TableCell style="lead-checkbox" checkbox supportingText>
  Iqbal Maulana
  <TableCell.Supporting>[email protected]</TableCell.Supporting>
</TableCell>

// Lead avatar checkbox
<TableCell style="lead-avatar-checkbox" checkbox avatar={user.avatar} supportingText>
  {user.name}
  <TableCell.Supporting>{user.email}</TableCell.Supporting>
</TableCell>

// Lead payment method checkbox
<TableCell style="lead-payment-checkbox" checkbox paymentLogo="visa" supportingText>
  Visa •••• 4242
  <TableCell.Supporting>Expires 04/27</TableCell.Supporting>
</TableCell>

Content Cells

Cells for displaying data in various visual formats.
One or more badge labels. Suitable for Status, Category, or Tag columns.

Badge (single)

● Active

Badges multiple

DesignFrontend
<TableCell style="badge">
  <Badge variant="success">Active</Badge>
</TableCell>

<TableCell style="badges-multiple">
  <Badge variant="blue">Design</Badge>
  <Badge variant="purple">Frontend</Badge>
</TableCell>

Action Cells

Cells for displaying action controls at the far right of a row.
StylePreviewDescription
Action buttonsDeleteEditText button without border
Action icons✏️🗑️📋Action icons without labels
Action dropdown iconSingle dropdown icon (kebab menu)
// Action buttons
<TableCell style="action-buttons">
  <TableCell.Action variant="ghost-danger">Delete</TableCell.Action>
  <TableCell.Action variant="ghost-primary">Edit</TableCell.Action>
</TableCell>

// Action icons
<TableCell style="action-icons">
  <TableCell.IconAction icon={<EditIcon />} label="Edit" />
  <TableCell.IconAction icon={<TrashIcon />} label="Delete" />
</TableCell>

// Action dropdown
<TableCell style="action-dropdown-icon">
  <Dropdown>
    <DropdownItem>Edit</DropdownItem>
    <DropdownItem destructive>Delete</DropdownItem>
  </Dropdown>
</TableCell>

Standalone Cells

Cells containing only a single interactive element with no accompanying text.

Checkbox only

Toggle only

<TableCell style="checkbox-only" />
<TableCell style="toggle-only" />

Cell States

Each cell supports three interaction states.
Normal state with no interaction. Cell background is transparent (white from the table).
Iqbal MaulanaProduct Designer

Properties

Each cell has 4 boolean properties that can be combined.
PropertyTypeDefaultDescription
checkboxbooleanfalseDisplays a checkbox on the left side of the cell
togglebooleanfalseDisplays a toggle button on the left side of the cell
supportingTextbooleanfalseDisplays small supporting text below the main text
trailingIconbooleanfalseDisplays a sort/dropdown icon in the header (only for Type=Header)
checkbox and toggle are mutually exclusive — they cannot be enabled simultaneously in the same cell.

Design Tokens

Table

TokenValue
Border1px solid #B9B9B9
Border radius4px
Row divider1px solid #EAECF0

Cell

ElementTokenValue
Paddinghorizontal24px
Paddingvertical16px
Row height (Header)52px
Row height (Default)72px
Primary textcolor#101828 (Gray/900)
Supporting textcolor#667085 (Gray/500)
Primary textfontInter Medium 14px
Supporting textfontInter Regular 14px
Header textfontInter Medium 12px
Header bg (White)#FFFFFF
Header bg (Gray)#F9FAFB
Hover row bg#F9FAFB

API Reference

Table

className
string
Additional class for the table wrapper.
bordered
boolean
default:"true"
Shows the outer table border.

TableCell

type
"default" | "header"
default:"\"default\""
Cell type — header for the header row, default for content rows.
style
"lead-checkbox" | "lead-toggle" | "lead-avatar-checkbox" | "lead-avatar-toggle" | "lead-icon-checkbox" | "lead-icon-toggle" | "badge" | "badges-multiple" | "trend-positive" | "trend-negative" | "progress-bar" | "avatar-group" | "action-buttons" | "action-icons" | "action-dropdown-icon" | "checkbox-only" | "toggle-only" | "star-ratings" | "lead-payment-checkbox" | "lead-payment-toggle" | "white-header" | "gray-header"
required
The cell’s visual style, which determines its content and layout.
state
"default" | "hover" | "disabled"
default:"\"default\""
The cell’s interaction state.
checkbox
boolean
default:"false"
Displays a checkbox on the left side of the cell.
toggle
boolean
default:"false"
Displays a toggle button on the left side of the cell.
supportingText
boolean
default:"false"
Displays supporting text below the main text.
trailingIcon
boolean
default:"false"
Displays a sort icon on the header cell.
sortable
boolean
default:"false"
Enables sort functionality on the header cell.
value
string | number
The value to display (trend, progress, star ratings).
change
string | number
The percentage change for the trend-positive / trend-negative type.

Accessibility

  • Use semantic <table>, <thead>, <tbody>, <tr>, <th>, <td> elements
  • Header cells use <th scope="col"> for clear column relationships
  • The “select all” checkbox in the header uses aria-label="Select all rows"
  • Tables with sorting add aria-sort="ascending" | "descending" | "none" to the header
  • Long tables use a descriptive aria-label or <caption>
  • Ensure the table can scroll horizontally on narrow viewports with overflow-x: auto
  • Action buttons within cells use an aria-label that includes the row name (e.g. aria-label="Edit Iqbal Maulana")

Do’s & Don’ts

Do

  • Use consistent cell styles for each column
  • Limit the number of columns to prevent overflow on small screens
  • Use the Gray Header for tables with many rows to improve readability
  • Always include an action column at the far right
  • Use supportingText to show secondary information without adding extra columns
  • Provide an aria-label on every action button

Don't

  • Don’t mix checkbox and toggle in the same table
  • Don’t use more than 2 badges in a single badges-multiple cell
  • Don’t place action buttons in any column other than the last one
  • Don’t render a table without a header
  • Don’t use overly long text in a cell — truncate with an ellipsis if necessary
  • Don’t use the progress-bar style for non-percentage values