DocsAPI Reference

API Reference

Cell Instance APIs

All the cell instance methods and objects that can be accessed from a cell in Shadcn Table


Every cell provides a cell object that can be used in many props or column definitions that let's you have access to a cell's information and methods.

You can access and use a cell object in quite a few places, but here are some of the most common:

const columns = [
  {
    accessorKey: 'username',
    header: 'Username',
    //you can access a cell in many callback column definition options like this
    stTableBodyCellProps: ({ cell }) => ({
      onClick: () => {
        console.log(cell.getValue(), cell.id);
      },
    }),
    //or in the component override callbacks like this
    Cell: ({ cell }) => {
      return <div>{cell.getValue()}</div>;
    },
  },
];

const table = useShadcnTable({
  columns,
  data,
  //or in callback props like this
  stEditTextFieldProps: ({ cell }) => ({
    disabled: cell.getValue() === 'admin',
  }),
});

NOTE: These are NOT props or column options for Shadcn Table. These are just static methods on a cell instance that you can use.

#
State Option
Type
More Info Links
1ST_Column<TData>TanStack Table Cell API Docs
2() => { table: Table<TData>; column: ST_Column<TData, TValue>; row: ST_Row<TData>; cell: Cell<TData, TValue>; getValue: <TTValue = TValue>() => TTValue; renderValue: <TTValue = TValue>() => TTValue | null; }TanStack Table Cell API Docs
3Not ProvidedTanStack Table Cell API Docs
4Not ProvidedTanStack Table Cell API Docs
5Not ProvidedTanStack Table Cell API Docs
6() => anyTanStack Table Cell API Docs
7stringTanStack Table Cell API Docs
8Not ProvidedTanStack Table Cell API Docs
9ST_Row<TData>TanStack Table Cell API Docs

Wanna see the source code for this table? Check it out down below!