LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Components

Data table

Also called data grid or sortable table

A table built for working with records: click a column header to sort, type to filter, and check rows to act on several at once.

import { useState } from 'react';
import { motion } from 'motion/react';

type Customer = { id: string; name: string; plan: string; seats: number };
type Column = 'name' | 'plan' | 'seats';

export function CustomersTable({ rows }: { rows: Customer[] }) {
  const [sort, setSort] = useState({ by: 'name' as Column, dir: 1 });
  const [query, setQuery] = useState('');
  const visible = rows
    .filter((row) => row.name.toLowerCase().includes(query.toLowerCase()))
    .sort((a, b) => (a[sort.by] > b[sort.by] ? sort.dir : -sort.dir));
  const order = sort.dir > 0 ? 'ascending' : 'descending';
  const arrow = sort.dir > 0 ? '↑' : '↓';
  // Clicking a header sorts by it; clicking it again flips the direction.
  const sortBy = (by: Column) =>
    setSort({ by, dir: sort.by === by ? -sort.dir : 1 });
  const header = (by: Column) => (
    <th aria-sort={sort.by === by ? order : 'none'}>
      <button onClick={() => sortBy(by)}>
        {by} {sort.by === by && arrow}
      </button>
    </th>
  );

  return (
    <div className='w-md text-sm'>
      <input
        value={query}
        onChange={(event) => setQuery(event.target.value)}
        placeholder='Filter by name'
        aria-label='Filter customers by name'
        className='mb-3 h-9 w-full rounded-lg border bg-background px-3'
      />
      <table className='w-full text-left'>
        <thead className='border-b text-muted-foreground [&_th]:py-2 [&_th]:font-medium [&_th]:capitalize [&_th:last-child]:text-right'>
          <tr>
            {header('name')}
            {header('plan')}
            {header('seats')}
          </tr>
        </thead>
        <tbody>
          {visible.map((row) => (
            // `layout` slides each row from its old position to its new one.
            <motion.tr
              key={row.id}
              layout
              className='border-b hover:bg-muted/50'
            >
              <td className='py-2 font-medium'>{row.name}</td>
              <td>{row.plan}</td>
              <td className='text-right tabular-nums'>{row.seats}</td>
            </motion.tr>
          ))}
        </tbody>
      </table>
    </div>
  );
}
Turn the customers list into a data table with columns Name, Plan, and Seats. Clicking a header sorts by that column and toggles ascending and descending with an arrow icon, and rows slide to their new positions over 250ms. Add a search box that filters by name as you type, a checkbox on each row plus select-all in the header, and a "2 selected" bar with a Delete button whenever rows are checked; set aria-sort on the sorted header.

Paste into Layerwise or any AI coding tool.

What is Data table?

A data table shows records in rows and their fields in columns, then adds tools on top: column headers that sort when clicked, with an arrow for the direction; a search or filter box; checkboxes to select rows for bulk actions such as Delete or Export; and often pagination for long sets.

Use it whenever people need to scan, compare, or manage many similar items, such as orders, users, invoices, or files. Cards can read better for a few items with images; once people compare fields side by side, use a table.

Right-align numbers and use tabular figures so digits line up, keep the header visible while scrolling, and highlight the row under the pointer. Build it with real <table> markup, use <th scope="col"> for headers, and set aria-sort on the sorted column so screen readers know the order.

Related terms

All terms

Pagination

Navigation that splits a long list into numbered pages with Previous and Next buttons, so people browse a fixed number of items at a time.

Checkbox

A small square you tick to turn an option on or select an item, with a dash in a parent box when only some items are checked.

Tabular numbers

A font setting that gives every digit the same width, so numbers line up in columns and timers or counters stop shifting as they change.

Layout animation

An animation that smoothly moves and resizes elements when the layout changes, such as list items gliding to new spots after a sort or filter.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit
5 customers
Lumen StudioPro12
Acme Inc.Pro24
OaklineStarter6
Juniper HealthBusiness58
Bluebird CaféStarter3