• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

TableRow

Wrapper for cells composing a single row.

Usage

import { TableRow } from 'nr1'

Props

actions

shape[]

Defines a set of actions that will appear when the user hovers the row. Actions have a mandatory text and onClick callbacks (that will be called with the item and index of the row they belong to), and they also accept a disabled property.

shape

disabled

boolean

label

REQUIRED
string
Use it to describe the row's action.

onClick

REQUIRED
function
Callback fired any time the user clicks on the action.

function (
event: React.MouseEvent
)

testId

string
Adds a data-test-id attribute. Use it to target the component in unit and E2E tests.For a test id to be valid, prefix it with your nerdpack id, followed up by a dot.For example, my-nerdpack.some-element. Note: You might not see data-test-id attributes as they are removed from the DOM, to debug them pass a e2e-test query parameter to the URL.

type

enum
Type of action for each of the items in the actions dropdown.It's not mandatory, its default is TableRow.ACTION_TYPE.NORMAL.

  • Normal — generic non-critical action.

  • Destructive — use when you have a destructive action like delete or remove, which you would like the user to pause and consider before completing.

    <One of

    TableRow.ACTION_TYPE.DESTRUCTIVE, TableRow.ACTION_TYPE.NORMAL,

    >
    const actions = [
    {
    label: 'Duplicate',
    type: TableRow.ACTION_TYPE.NORMAL,
    },
    {
    label: 'Delete',
    type: TableRow.ACTION_TYPE.DESTRUCTIVE,
    },
    ];
    const actions = [
    {
    label: 'Action 1',
    disabled: true,
    onClick: (evt, { item, index }) => {
    alert(`Action 1:Item: ${index}${JSON.stringify(item, null, 2)}`);
    },
    },
    {
    label: 'Action 2',
    onClick: (evt, { item, index }) => {
    alert(`Action 2:Item: ${index}${JSON.stringify(item, null, 2)}`);
    },
    },
    ];

children

REQUIRED
node

List of row cells, in the shape of <TableRowCell>s. Cells need to be direct children of the row, i.e. there must not be any node between <TableRow> and <TableRowCell>s.

onClick

function

Callback fired any time the user clicks on the table row.

function (
event: React.MouseEvent
)
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.