• Log inStart now

Now that we've migrated this site's content to docs.newrelic.com, we're EOLing this site on June 21st 2024.

AccountPicker

Usage

import { AccountPicker } from 'nr1'

Examples

Props

ariaLabelstring

Provide a descriptive label for this control, e.g. "Accounts".

classNamestring

Appends class names to the component.

Should be used only for positioning and spacing purposes.

crossAccountboolean
DEFAULT
false

Shows an option at the top named "All accounts". When selected, the value provided by the onChange callback is AccountPicker.CROSS_ACCOUNT. This is useful when you have functionality that can operate on multiple accounts.

disabledboolean

If true, the dropdown is not available for interaction.

labelstring

Text to display as label.

labelInlineboolean

Display the label inline the form control.

Use only when the component is not inside a Form. In that case set layoutType to Form.LAYOUT_TYPE.SPLIT in the Form component.

onChangefunction

Callback fired every time the user clicks an account from the list.

function (
event: React.MouseEvent,
value: number

Id of the account selected.

)
spacingTypeenum[]

Spacing property. Spacing is defined as a tuple of zero to four values, which follow the same conventions as CSS properties like margin or padding. To omit a value, use SPACING_TYPE.OMIT.

<Array of
<One of
AccountPicker.SPACING_TYPE.EXTRA_LARGE,
AccountPicker.SPACING_TYPE.LARGE,
AccountPicker.SPACING_TYPE.MEDIUM,
AccountPicker.SPACING_TYPE.NONE,
AccountPicker.SPACING_TYPE.OMIT,
AccountPicker.SPACING_TYPE.SMALL,
>
>
styleobject

Inline style for custom styling.

Should be used only for positioning and spacing purposes.

testIdstring

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.

valuenumber|enum

Id of the selected account.

Copyright © 2024 New Relic Inc.

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