# TableRow

**📖 Live documentation:** https://cds.coinbase.com/components/data-display/TableRow/

Defines rows within a Table.

## Import

```tsx
import { TableRow } from '@coinbase/cds-web/tables/TableRow'
```

## Examples

### Basic usage

```tsx live
<Table bordered variant="ruled">
  <TableBody>
    <TableRow>
      <TableCell title="Basic Row" />
    </TableRow>
    <TableRow backgroundColor="bgAlternate">
      <TableCell title="Row with Background" />
    </TableRow>
    <TableRow color="fgPrimary">
      <TableCell title="Row with Custom Text Color" />
    </TableRow>
  </TableBody>
</Table>
```

### Interactive Rows

```tsx live
function InteractiveExample() {
  const handlePress = () => console.log('Row clicked');

  return (
    <Table bordered>
      <TableBody>
        <TableRow onClick={handlePress}>
          <TableCell
            direction="horizontal"
            title="Clickable Row"
            end={
              <Button variant="secondary" compact>
                Action
              </Button>
            }
          />
        </TableRow>
        <TableRow onClick={handlePress} disableHoverIndicator>
          <TableCell
            direction="horizontal"
            title="Clickable Row (No Hover)"
            end={
              <Button variant="secondary" compact>
                Action
              </Button>
            }
          />
        </TableRow>
      </TableBody>
    </Table>
  );
}
```

### Full Width Rows

```tsx live
<Table bordered>
  <TableBody>
    <TableRow fullWidth>
      <HStack gap={2} alignItems="center">
        <Icon name="check" />
        <Text>Full Width Content</Text>
        <Button variant="secondary" compact>
          Action
        </Button>
      </HStack>
    </TableRow>
    <TableRow fullWidth>
      <HStack gap={2} alignItems="center">
        <Icon active name="warning" />
        <Text>Another Full Width Row</Text>
        <Button variant="secondary" compact>
          Action
        </Button>
      </HStack>
    </TableRow>
  </TableBody>
</Table>
```

### Responsive Spacing

```tsx live
function ResponsiveExample() {
  const responsiveConfig = {
    phone: {
      innerSpacing: { spacingHorizontal: 2 },
      outerSpacing: { spacingVertical: 1 },
    },
    desktop: {
      innerSpacing: { spacingHorizontal: 4 },
      outerSpacing: { spacingVertical: 2 },
    },
  };

  return (
    <Table bordered>
      <TableBody>
        <TableRow fullWidth innerSpacing={responsiveConfig.phone.innerSpacing}>
          <HStack gap={2} alignItems="center">
            <Icon name="check" />
            <Text>Responsive Spacing Row</Text>
            <Button variant="secondary" compact>
              Action
            </Button>
          </HStack>
        </TableRow>
      </TableBody>
    </Table>
  );
}
```

## Props

| Prop | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `backgroundColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `undefined` | Set the background color for this entire row to some CDS Palette background color name |
| `children` | `string \| number \| bigint \| false \| true \| ReactElement<unknown, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| Promise<AwaitedReactNode> \| string & ReactElement<unknown, string \| JSXElementConstructor<any>> \| string & Iterable<ReactNode> \| string & ReactPortal \| string & Promise<AwaitedReactNode> \| number & ReactElement<unknown, string \| JSXElementConstructor<any>> \| number & Iterable<ReactNode> \| number & ReactPortal \| number & Promise<AwaitedReactNode> \| bigint & ReactElement<unknown, string \| JSXElementConstructor<any>> \| bigint & Iterable<ReactNode> \| bigint & ReactPortal \| bigint & Promise<AwaitedReactNode> \| false & ReactElement<unknown, string \| JSXElementConstructor<any>> \| false & Iterable<ReactNode> \| false & ReactPortal \| false & Promise<AwaitedReactNode> \| true & ReactElement<unknown, string \| JSXElementConstructor<any>> \| true & Iterable<ReactNode> \| true & ReactPortal \| true & Promise<AwaitedReactNode> \| ReactElement<unknown, string \| JSXElementConstructor<any>> & string \| ReactElement<unknown, string \| JSXElementConstructor<any>> & number \| ReactElement<unknown, string \| JSXElementConstructor<any>> & bigint \| ReactElement<unknown, string \| JSXElementConstructor<any>> & false \| ReactElement<unknown, string \| JSXElementConstructor<any>> & true \| ReactElement<unknown, string \| JSXElementConstructor<any>> & Iterable<ReactNode> \| ReactElement<unknown, string \| JSXElementConstructor<any>> & ReactPortal \| ReactElement<unknown, string \| JSXElementConstructor<any>> & Promise<AwaitedReactNode> \| Iterable<ReactNode> & string \| Iterable<ReactNode> & number \| Iterable<ReactNode> & bigint \| Iterable<ReactNode> & false \| Iterable<ReactNode> & true \| Iterable<ReactNode> & ReactElement<unknown, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> & ReactPortal \| Iterable<ReactNode> & Promise<AwaitedReactNode> \| ReactPortal & string \| ReactPortal & number \| ReactPortal & bigint \| ReactPortal & false \| ReactPortal & true \| ReactPortal & ReactElement<unknown, string \| JSXElementConstructor<any>> \| ReactPortal & Iterable<ReactNode> \| ReactPortal & Promise<AwaitedReactNode> \| Promise<AwaitedReactNode> & string \| Promise<AwaitedReactNode> & number \| Promise<AwaitedReactNode> & bigint \| Promise<AwaitedReactNode> & false \| Promise<AwaitedReactNode> & true \| Promise<AwaitedReactNode> & ReactElement<unknown, string \| JSXElementConstructor<any>> \| Promise<AwaitedReactNode> & Iterable<ReactNode> \| Promise<AwaitedReactNode> & ReactPortal` | No | `-` | Children are required, and should always include TableCell \| TableCell[]. |
| `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `undefined` | Set the text color for this entire row to some CDS Palette foreground color name |
| `disableHoverIndicator` | `boolean` | No | `false` | By default, we set a hover background color of palette.backgroundAlternate on hover for the row. Use this prop to disable this behavior |
| `fullWidth` | `boolean` | No | `undefined` | Should this row span the entire width of the table? Useful for treating a row as a Control Strip. |
| `innerSpacing` | `CellSpacing` | No | `-` | The spacing to use on the inner content of Cell. Will only take effect when fullWidth is set to true |
| `onChange` | `FormEventHandler<HTMLDivElement>` | No | `-` | - |
| `onClick` | `MouseEventHandler<Element> \| (() => void)` | No | `noop` | Callback to fire when pressed |
| `outerSpacing` | `CellSpacing` | No | `-` | The spacing to use on the parent wrapper of Cell. Will only take effect when fullWidth is set to true |
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID |


