DocsAPI Reference

API Reference

Row Instance APIs

All the row instance methods and objects that can be accessed from the table instance in Shadcn Table

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

Every row in the table has an associated row instance that can be accessed in many of the callback props that you can use to access a row's information and methods.

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

const columns = [
  {
    accessorKey: 'salary',
    header: 'Salary',
    //you can access a row instance in column definition option callbacks like this
    stEditTextFieldProps: ({ row }) => ({
      disabled: row.original.employmentStatus === 'Retired',
    }),
    //or in the component override callbacks like this
    Cell: ({ cell, row }) => (
      <div>
        {row.original.employmentStatus === 'Retired'
          ? 'Retired'
          : cell.getValue()}
      </div>
    ),
  },
];

const table = useShadcnTable({
  columns,
  data,
  //or a row instance in callback props like this
  stSelectCheckboxProps: ({ row }) => ({
    disabled: row.original.isAccountActive === false,
  }),
  renderDetailPanel: ({ row }) => (
    <div>
      <span>First Name: {row.original.firstName}</span>
      <span>Last Name: {row.original.lastName}</span>
    </div>
  ),
});
#
State Option
Type
More Info Links
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

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