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 OptionTypeDescription
columnFilters
columnFiltersMeta
depth
getAllCells
getCanExpand
getCanMultiSelect
getCanPin
getCanSelect
getCanSelectSubRows
getCenterVisibleCells
getEndVisibleCells
getGroupingValue
getIsAllParentsExpanded
getIsAllSubRowsSelected
getIsExpanded
getIsGrouped
getIsPinned
getIsSelected
getIsSomeSelected
getLeafRows
getParentRow
getParentRows
getPinnedIndex
getStartVisibleCells
getToggleExpandedHandler
getToggleSelectedHandler
getUniqueValues
getValue
getVisibleCells
id
index
original
originalSubRows
parentId
pin
renderValue
subRows
toggleExpanded
toggleSelected

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