# Badge (/docs/components/badge) Use a badge to show a short status, such as the status of a transaction. Draft Pending Approval Approved On Hold Rejected New ```html Draft Pending Approval Approved On Hold Rejected New ``` ## Tones [#tones] `neutral` is the default: dark text on a grey tint. `info`, `success`, `warning` and `danger` use a soft tint with text in the tone colour. `accent` uses the accent colour on its soft tint. Every tone has square corners and no dot, and its text passes 4.5:1 contrast. Use `neutral` for ordinary states such as Draft. Keep colour for a state that needs attention. ## In the data grid [#in-the-data-grid] A data grid column with `type: 'badge'` shows the same label. `tones` maps each value to a tone. See [Data grid](/docs/components/data-grid). ## API [#api] # Button (/docs/components/button) Use a button for actions in forms, toolbars and dialogs. Save Cancel Export More Delete ```html Save Cancel Export More Delete ``` ## Sizes [#sizes] Small Medium Large ```html Small Medium Large ``` ## States [#states] Saving Disabled ```html Saving Disabled ``` ## In a form [#in-a-form] `type="submit"` submits the closest `
`, including in a Suitelet form. ```html Submit
``` ## API [#api] # Card and Grid (/docs/components/card) Use a card to group related content. Use a grid inside it to lay out fields in columns, like a NetSuite record header. Edit Cancel Save ```html Edit Cancel Save ``` ## Card header and footer [#card-header-and-footer] The header shows when the card has a `heading` or content in the `actions` slot. The footer shows only when the `footer` slot has content. A card with no heading and no footer. ```html A card with no heading and no footer. ``` ## Flush [#flush] `flush` removes the body padding. Use it for content that must touch the card edges, such as a data grid. ```html ``` ## Grid columns [#grid-columns] The grid has 3 columns by default. Set `columns` to change it. The grid measures its own width, not the window. It changes to 2 columns when it is 720px wide or less, and to 1 column at 460px or less. A grid in a narrow card collapses even on a wide screen. ```html ``` ## Spanning cells [#spanning-cells] Put `span="2"` on a child to fill two columns. Put `span="full"` on a child to fill the whole row. ```html ``` ## API [#api] ### nsui-card [#nsui-card] ### nsui-grid [#nsui-grid] # Checkbox (/docs/components/checkbox) Use a checkbox for a yes or no value. Add `switch` for a toggle switch. ```html ``` ## Switch [#switch] ```html ``` ## Disabled [#disabled] ```html ``` ## Form value [#form-value] When checked, the checkbox submits `value`, which is `T` by default. When unchecked, it submits nothing. ```html
``` ## In NetSuite [#in-netsuite] Set `field` to bind the checkbox to a native body field. ```html ``` The label, the checked state and the disabled state come from the record. Each change writes back with `setValue`. ## API [#api] # Data Grid (/docs/components/data-grid) Use a data grid for sublist lines, search results and any list of records. It sorts, searches, selects, pages, totals and edits in place. Bind it to a native sublist with `sublist="item"`.
```html ```
Set `columns` and `rows` as properties from script. The attributes also accept JSON, which suits server-rendered HTML. Click a column header to sort: ascending, descending, then off. ## Column types and alignment [#column-types-and-alignment] `type` sets the format and the default alignment. `number`, `currency`, `percent` and `actions` align right; all other types align left. Set `align` to `left`, `right` or `center` to override it. | Type | Output | | --- | --- | | `text` | Plain text. An empty value shows a dash. | | `number` | `Intl.NumberFormat`, up to 4 decimals. | | `currency` | `Intl.NumberFormat` in the grid's `currency` (default `USD`). | | `percent` | `0.25` shows as `25%`. | | `date` | `YYYY-MM-DD` or any date string, in medium date style. | | `badge` | The same label as `nsui-badge`. `tones` maps a value to `success`, `warning`, `danger` or `info`. A value with no tone is `neutral`. | | `link` | A link. `href` is a row field name, or `(row) => url`. Only `http`, `https`, `mailto` and relative URLs become links; any other URL shows as plain text. `target: '_blank'` adds `rel="noopener noreferrer"`. | | `mono` | Monospace text, for SKUs and IDs. | | `actions` | Icon buttons from `actions`. See [Row actions](#row-actions). | `number`, `currency` and `percent` cells and totals use tabular figures in one colour. A column with `format` or `options` shows its own text.
```js grid.columns = [ { key: 'sku', label: 'SKU', type: 'mono' }, // href names a row field. A function (row) => url also works. { key: 'item', label: 'Item', type: 'link', href: 'url' }, { key: 'status', label: 'Status', type: 'badge', tones: { Committed: 'success', Backordered: 'danger', 'Partially Fulfilled': 'warning' } }, { key: 'qty', label: 'Qty', type: 'number' }, { key: 'rate', label: 'Rate', type: 'currency' }, { key: 'amount', label: 'Amount', type: 'currency' }, ]; ```
`format: (value, row) => string` replaces the text of any column. Search matches the formatted text. Set `currency` and `locale` on the grid to change the currency code and the number and date format. ```html ``` ## Search, column toggle and density [#search-column-toggle-and-density] `searchable` adds a search box. It matches the text of the visible columns. `column-toggle` adds a **Columns** menu to show and hide columns. A column with `hidden: true` never shows and is not in the menu. `density-toggle` adds a button that switches `density` between `default` and `compact`.
```html ```
Put your own actions in the `toolbar` slot. They sit on the right side of the toolbar. ```html Remove ``` ## Filters [#filters] Set `filter: true` on a column to add a filter button for it to the toolbar. The button opens a panel with the column's distinct values and a count for each. Tick values to filter the rows. Values in one column combine with OR. Filters on different columns combine with AND. Each count shows how many rows would match that value, under the search and the other columns' filters.
```html ```
- The panel lists the column's labels: from `options`, then `format`, else the formatted value. It filters by the raw values. - A search box appears when a column has more than 8 values. - **Clear** empties one column's filter. **Reset filters** appears in the toolbar when any filter is active, and empties them all. - A change goes back to page 1. Selected rows that no longer pass the filters leave the selection, and `selectionchange` fires. - A column with `hidden: true`, or one hidden with the column menu, still filters. `filters` holds the active filters: an object of column key to an array of values. Set it as a property, or as JSON in the attribute. The grid sets a new object each time the user changes a filter. It does not write the attribute back. ```html ``` The property also accepts a JSON string, as `columns` and `rows` do. Keyboard: Enter or Space on a filter button opens its panel and moves focus to the first value (or the search box). Arrow keys move between values. Space ticks a value. Escape closes the panel and returns focus to the button. ## Selection [#selection] `selectable` adds a checkbox column. The header checkbox selects all rows on the current page. Each change fires `selectionchange` with the selected keys and rows. Keys come from the `row-key` field (default `id`), or the row index when that field is missing.
```html ```
When `rows` changes, the grid drops selected keys that no longer exist. ## Paging [#paging] `page-size` turns on paging. `0` (the default) shows all rows. The pager has a rows-per-page select (10, 25, 50, 100) and page buttons. Search and sort apply to all rows before paging.
```html ```
## Totals [#totals] `totals` adds a footer row. Each column with a `total` shows a value: `sum`, `avg`, `count`, or a function `(rows) => value`. The first column shows "Total" when it has no total of its own. Totals use all rows that match the search, not only the current page.
```js grid.columns = [ { key: 'item', label: 'Item' }, { key: 'qty', label: 'Qty', type: 'number', total: 'sum' }, { key: 'rate', label: 'Rate', type: 'currency', total: 'avg' }, { key: 'amount', label: 'Amount', type: 'currency', total: 'sum' }, ]; ```
## Inline editing [#inline-editing] Set `editable: true` on a column. Click a cell, or focus it and press Enter or F2, to open the editor. The editor is a number input for numeric types, a date input for `date`, a select when the column has `options`, and a text input otherwise. | Key | Action | | --- | --- | | Enter | Commit and close. | | Escape | Close without a change. | | Tab / Shift+Tab | Commit and open the next or previous editable cell. | | Blur | Commit and close. | A changed value fires `cellchange`. If you do not cancel it, the grid writes the value to the row object and marks the cell with a corner flag. Call `markClean()` after a save to clear the flags. Call `preventDefault()` to reject the value.
```html ```
The grid does not compute other columns. Update them in your `cellchange` handler, as above. If you mutate `rows` in place outside an edit, call `refresh()`. Assign a new array to `rows` to re-render and clear the dirty flags. ## Pinned columns [#pinned-columns] `pin: 'start'` keeps a column on the left during horizontal scroll. `pin: 'end'` keeps it on the right. Pinned columns move to the start or end of the column order. The selection checkbox pins too when any column pins to the start.
```js grid.columns = [ { key: 'line', label: '#', type: 'number', width: 48, pin: 'start' }, { key: 'sku', label: 'SKU', type: 'mono', pin: 'start' }, { key: 'item', label: 'Item', width: 260 }, // ...more columns { key: 'amount', label: 'Amount', type: 'currency', pin: 'end' }, ]; ```
Set `--nsui-grid-max-height` to scroll the body vertically. The header and the totals row stay in place. ## Row status [#row-status] A row with `_status` set to `new`, `changed` or `deleted` gets a green, amber or red tint. A `deleted` row also shows its text struck through. Set `status-key` to read the status from another field.
```js grid.rows = [ { id: '1', item: 'Steel Bracket 40mm', qty: 12 }, { id: '2', item: 'Hex Bolt M8 (box/100)', qty: 40, _status: 'changed' }, { id: '4', item: 'Gasket Kit GK-7', qty: 6, _status: 'deleted' }, { id: '5', item: 'Bearing 6204-2RS', qty: 24, _status: 'new' }, ]; ```
## Expandable rows [#expandable-rows] `expandable` adds a chevron button to each row. It opens a detail row directly under that row. Put the detail content in light DOM with `slot="detail-"`: your page styles, forms and NSUI components work inside it. - `expanded` lists the open row keys. Set it to open rows from code; the grid updates it when a user toggles a row. - `detail-mode="single"` (the default) closes the open row when another opens. `multi` keeps several open. - The detail stays in view when the columns scroll sideways. - Keyboard: Enter or Space toggles the focused chevron; Right Arrow opens and Left Arrow closes.
Committed 12 · Fulfilled 12 · Billed 12
Committed 40 · Fulfilled 0 · Billed 0 · Ship date Dec 9, 2026
Backordered 1 · Next receipt Dec 14, 2026
```html
Committed 40 · Fulfilled 0 · Billed 0
```
Detail content is your own markup, never an HTML string from data, so it cannot inject script. ## Cell marks, tones and weight [#cell-marks-tones-and-weight] Three column fields change how a cell looks. None of them takes HTML. - `mark: (value, row) => name | { name, label, tone } | null` puts a 16px mark before the text. `tone` replaces the mark's default colour. Names: `locked` (padlock), `blocked` (slash), `edited` (ring), `new` (plus), `warning` (triangle). The label is the mark's accessible name and tooltip; each name has a default. Any other name shows nothing. - `tones` colours the cell text on any column that is not a `badge`, with the same map or function as a badge: `success`, `warning`, `danger` or `info`. - `weight`: `regular` (default), `medium` or `semibold`, or `(value, row) => weight` for one cell at a time.
```js grid.columns = [ { key: 'item', label: 'Item', weight: 'semibold' }, { key: 'avail', label: 'Available', type: 'number', tones: (v) => (v === 0 ? 'danger' : undefined), // A function, so set columns as a property to use marks. mark: (v, row) => (row.locked ? 'locked' : v === 0 ? { name: 'blocked', label: 'Out of stock' } : null) }, ]; ```
## Row actions [#row-actions] A column with `type: 'actions'` shows icon buttons in each row. `actions` lists them: `{ name, icon, label, disabled?, hidden? }`. `icon` is `trash` or `restore`. `label` is the button's accessible name and tooltip. `disabled` and `hidden` are `(row) => boolean`: a disabled button shows dimmed, a hidden one is left out for that row. A click fires `rowaction` with `{ name, key, row, index }`; `rowclick` does not fire. The column does not sort and search skips it. Pin it with `pin: 'end'` to keep it in view.
```js grid.columns = [ { key: 'item', label: 'Item' }, { key: 'act', label: '', type: 'actions', pin: 'end', actions: [ { name: 'delete', icon: 'trash', label: 'Delete line', disabled: (row) => row.fulfilled > 0, hidden: (row) => row._status === 'deleted' }, { name: 'restore', icon: 'restore', label: 'Restore line', hidden: (row) => row._status !== 'deleted' }, ] }, ]; grid.addEventListener('rowaction', (e) => { e.detail.row._status = e.detail.name === 'delete' ? 'deleted' : undefined; grid.refresh(); }); ```
## Theming [#theming] Set these tokens on the grid or on any ancestor. Each one defaults to the look above. | Token | Sets | Default | | --- | --- | --- | | `--nsui-grid-header-bg` | Header row background | `--nsui-bg` | | `--nsui-grid-header-fg` | Header text colour | `--nsui-fg` | | `--nsui-grid-header-weight` | Header font weight | `500` | | `--nsui-grid-divider` | 1px rule between columns | none | | `--nsui-grid-stripe` | Background of every second line (detail rows do not count) | none | | `--nsui-grid-edited-bg` | Fill of an edited cell, under the corner mark | none | | `--nsui-grid-max-height` | Height after which the body scrolls | none | For anything else in the header, style `::part(header)`.
```css .order-lines { --nsui-grid-header-bg: var(--nsui-bg-subtle); --nsui-grid-header-weight: 600; --nsui-grid-divider: var(--nsui-border); --nsui-grid-stripe: var(--nsui-bg-subtle); } ```
## Loading [#loading] `loading` replaces the body with skeleton rows while you fetch data. The totals row hides while it loads.
```html ```
When no rows match, the body shows `empty-text` (default "No results."). ## Events [#events] All events bubble and cross the shadow boundary. | Event | Detail | Cancel effect | | --- | --- | --- | | `sort` | `{ key, dir }`, `dir` is `'asc'`, `'desc'` or `null` | Keeps the current sort. | | `selectionchange` | `{ keys, rows }` | None. | | `cellchange` | `{ row, key, value, oldValue, index }` | Keeps the old value. | | `filterchange` | `{ key, values, filters }`. `key` is `null` for **Reset filters**. | Keeps the current filters. | | `rowclick` | `{ row, index }` | None. | | `rowtoggle` | `{ key, row, open }` | Keeps the row open or closed. | | `rowaction` | `{ name, key, row, index }` | None. | `index` is the position in `rows`, not in the sorted or paged view. `rowclick` does not fire for clicks on checkboxes, links, buttons or editable cells. ## In NetSuite [#in-netsuite] Add `sublist="item"` to bind the grid to a native sublist on a record page. Each column `key` is a sublist field ID. Set `field` on a column when the key differs from the field ID, and `text: true` to show the field's display text instead of its value. ```html ``` - The native record stays the source of truth. The grid reads every line with `getLineCount` and `getSublistValue` (or `getSublistText`). - An edit cancels the grid's own write. The binding then calls `selectLine`, `setCurrentSublistValue` and `commitLine`, so NetSuite runs `fieldChanged`, sourcing and `validateLine` as usual. - If `commitLine` throws, or the committed value differs from the new value, the binding calls `cancelLine`. It fires a cancelable `nserror` event and, if not cancelled, shows a "Line not saved" toast. The grid then re-reads the record, so the cell reverts. - The grid polls the sublist about every 1.2 seconds. It skips a poll while a cell editor is open. Call `NSUI.sync()` from a client script for an instant refresh. - In view mode, all columns become read-only. ## API [#api] # Date picker (/docs/components/date-picker) The date picker is not a separate element. Use `nsui-input type="date"`: it shows a text field in the locale's date format and a calendar button that opens a month grid below the field. The full reference is in [Input › Date](/docs/components/input#date). ```html ``` ## What it does [#what-it-does] - **Value:** always ISO `YYYY-MM-DD`, in events, in form data and for NetSuite. The field shows the date in the locale format. - **Typing:** type a date in the locale format (`12/24/2026` in en-US) or as ISO. Text that is not a date shows the error style and blocks form submission. - **Limits:** days before `min` and after `max` are struck through and cannot be picked. - **Locale:** `locale` sets the format, the month and weekday names, and the first day of the week. ## Keyboard [#keyboard] Alt+ArrowDown in the field, or Enter on the calendar button, opens the calendar. In the calendar, the arrow keys move by day and week, PageUp and PageDown move by month (with Shift, by year), Home and End go to the week edges, Enter picks the day, and Escape closes and returns to the field. ## Not available yet [#not-available-yet] There is no calendar without a field (always open on the page) and no date range picker. Ask for them if a page needs them. # Dialog (/docs/components/dialog) Use a dialog to ask for a decision or show a short form on top of the page. It uses the native `` top layer, so NetSuite z-index and overflow rules cannot clip it. ```html Approve bill

Approve VB-1042 for $4,855.00?

Cancel Approve
```
## Opening and closing [#opening-and-closing] - Call `show()` or set the `open` attribute to open the dialog. - Call `close(returnValue)` to close it. - Any element inside the dialog with `data-close` closes it. The attribute value becomes the `returnValue`. An empty `data-close` gives `dismiss`. The `close` event fires with `event.detail.returnValue`. Escape, a backdrop click and the close button give `dismiss`. ## Not dismissable [#not-dismissable] Set `dismissable="false"` to hide the close button and ignore Escape and backdrop clicks. The user must then use a footer button. ```html

Choose an open period to continue.

OK
``` ## Width [#width] The dialog is 520px wide. Set `--nsui-dialog-width` to change it. The width never exceeds the window width minus 32px. ```html ... ``` ## confirm() [#confirm] `confirm()` opens a dialog with Cancel and confirm buttons. It returns a promise that resolves to `true` when the user confirms, and to `false` on Cancel or a dismiss. `tone: 'danger'` makes the confirm button red. ```js const ok = await NSUI.confirm({ heading: 'Delete this line?', message: 'The line is removed from the order.', confirmLabel: 'Delete', tone: 'danger', }); if (ok) { // delete the line } ``` | Option | Default | | --- | --- | | `heading` | `Are you sure?` | | `message` | empty | | `confirmLabel` | `Confirm` | | `cancelLabel` | `Cancel` | | `tone` | `primary` (`danger` for a red button) | With the ES module build, import it: `import { confirm } from 'nsui';`. ## API [#api] # Facts (/docs/components/facts) Use facts to show figures that people read but do not edit. `variant="list"` is a titled column for a detail panel. `variant="totals"` is a money summary with a large total. Numbers use the same format as the data grid, in one colour: the currency sign, digits and cents are not muted.
```html ```
## Items [#items] `items` is a list of rows. Set it as a property, or as JSON in the attribute. | Field | Meaning | | --- | --- | | `label` | Row label. Text only. | | `value` | The figure. `0` shows as a muted 0 (or `$0.00`); `null` shows "—" for no value. | | `type` | `number`, `currency`, `percent` or `text`. Default: `number` for a number, else `text`. | | `note` | Small text after the label: "not yet fulfilled". | | `tip` | An info button after the label with this text. | | `tone` | `danger` colours the label and value red. | | `total` | `totals` only: the row shown large under the rule. | Side-by-side lists line up row by row only when they have the same number of rows. Set `rule` on the second and later lists for a divider. ## Totals [#totals] ```html
Memo: Spring restock, ship complete
```
- The item with `total: true` shows large under a rule. - `baseline` is the saved total. When the total differs, an amber line shows the change: "+$1,240.60 since last save". Set `delta-label` to change the words. - Put a memo or any other line above the rows with `slot="header"`. ## Accessibility [#accessibility] The rows are a description list, so screen readers read each label with its value. The element is a group named by its heading, or "Totals". The change line reads "Changed: +$1,240.60 since last save". ## API [#api] # Field group (/docs/components/field-group) Use a field group to show a record's header facts at a glance: customer, terms, dates, margin. Each `nsui-field-view` is one label and value. A view can be editable, locked with a reason, empty, or carry a [tip](/docs/components/tip). For fields people type into, use [Input](/docs/components/input) and [Select](/docs/components/select).
```html ```
## Views [#views] | Set | Result | | --- | --- | | `value` | Display text. Text only, never HTML. Empty shows "—". | | `editable` | The value is a button. Hover shows a border and a pencil. Click, Enter or Space fires `editrequest`. | | `placeholder` | Shown in a light tone when an editable view has no value. | | `locked="reason"` | A lock after the value. The reason is the tooltip and is read by screen readers. Wins over `editable`. | | `tip="text"` | An info button after the label with this text. | | `tone="danger"` | Red value text, for a value that needs attention. | Labels and values line up in every state, so nothing shifts on hover. ## Editing [#editing] v1 does not edit in place. Listen for `editrequest` and open your own editor, then set `value`: ```js document.addEventListener('editrequest', async (e) => { const view = e.target; const next = await openShipDateDialog(e.detail.value); // your editor if (next) view.value = next; }); ``` `e.detail` is `{ name, value }`. ## Columns [#columns] `columns` is 1, 2 or 3 (default 2). The group drops to at most 2 columns below 520px of its own width, and to 1 below 320px. ## In NetSuite [#in-netsuite] Add `field` to bind a view read-only to the current record, as with `nsui-input field="memo"`: ```html ``` - The label comes from the field, unless you set `label`. - The value is the field's display text (`getText`), refreshed with the record. - A field that is disabled on the form locks the view with "Not editable on this form", unless you set `locked`. - A field that is not on the form shows "—". - The binding never writes to the record. ## API [#api] # Input (/docs/components/input) Use an input for free text, numbers, amounts and dates. ```html ``` ## Currency [#currency] `type="currency"` renders a right-aligned number input with step `0.01`. On commit, it rounds the value to 2 decimals. ```html ``` ## Date [#date] `type="date"` shows a text field in the locale's date format and a calendar button. The button opens a calendar below the field. `value` is always ISO `YYYY-MM-DD`, in events, in form data and for NetSuite. ```html ``` - Type a date in the locale format (`12/24/2026` in en-US) or as ISO (`2026-12-24`). On blur, the field shows it in the locale format. - Text that is not a date shows the error style and blocks form submission. - Days before `min` and after `max` are struck through and cannot be picked. - `locale` sets the format, the month and weekday names and the first day of the week. Without it, the browser locale applies. Calendar keys: | Key | Action | | --- | --- | | Alt+ArrowDown (in the field) | Open the calendar | | Arrow keys | Move by day or week | | PageUp / PageDown | Move by month. With Shift, by year. | | Home / End | First or last day of the week | | Enter / Space | Pick the day | | Escape | Close and return to the field | ## Stepper [#stepper] Set `stepper` on a `number` or `currency` input to show − and + buttons beside the field. Each click adds or subtracts `step` (1 for numbers, 0.01 for currency). The value stays within `min` and `max`, and a button is disabled at its limit. Hold a button to repeat. ArrowUp and ArrowDown in the field step the same way. ```html ``` The buttons are not in the Tab order, because the field already steps with the arrow keys. Each step fires `input` and `change`, updates the form value and, with `field`, writes to the record, the same as typing. Number and currency inputs never show the browser's spin arrows, with or without `stepper`. ## Hint and error [#hint-and-error] `hint` shows help text. `error` shows an error message, marks the field invalid and blocks form submission. ```html ``` ## States [#states] ```html ``` ## In NetSuite [#in-netsuite] Set `field` to bind the input to a native body field. ```html ``` The label, input type, mandatory and disabled state come from the record. Each committed change writes back with `setValue`. Attributes you set yourself, such as `label` or `type`, win. ## API [#api] # Meter (/docs/components/meter) Use a meter for a share of a known limit: credit used against a credit limit, or the past-due share of open invoices. Put the value text inside the element. For details, add a [tip](/docs/components/tip) after it.
0% 25% 50% 75% 100% 132%
62% used 58 of 65 committed
```html 0% 25% 50% 75% 100% 132% 62% used 58 of 65 committed ```
## Tone [#tone] The share is (`value` + `pending`) / `max`. With the default `tone="auto"`: | Share | Tone | | --- | --- | | Under `warn-at` (default 0.75) | accent | | From `warn-at` to `max` | warning | | Over `max` | danger, and the ring is drawn full | Set `tone` to `accent`, `success`, `warning` or `danger` when the meaning of the ring is fixed. `auto` never picks `success`; set it when a full share is good news, such as the committed share of an order. The past-due share of open invoices is always danger: ```html $41,281 58 of 65 committed ``` ## Pending [#pending] `pending` is the amount this record would add, such as the unsaved lines of an order. The meter draws it as a lighter second arc after the used arc, and writes it as text after the value: `pending="9000" max="60000" pending-label="this order"` gives "· +15% this order". ## Accessibility [#accessibility] - Name the meter with `aria-label` or `aria-labelledby`, for example "Credit used". - The element has `role="meter"`. `aria-valuenow` stays inside the range, as ARIA requires. `aria-valuetext` gives the real state, for example "132% used, over limit". - The meter does not move when its value changes. It redraws at once. ## API [#api] # Popover (/docs/components/popover) Use a popover to show short content next to a button: a status filter, column choices or a help note. It uses the native Popover API, so the panel sits in the top layer. NetSuite z-index rules and `overflow: hidden` containers cannot clip it. Status filter
```html Status filter
```
## Trigger [#trigger] Set `for` to the `id` of the trigger. A click on the trigger opens the panel. A second click closes it. The trigger can be any element. It must be in the same document as the popover, or in the same shadow root. The popover sets `aria-expanded` on the trigger. ## Closing [#closing] - A click outside the panel closes it. - Escape closes it. - `hide()` closes it, and so does removing the `open` attribute. A click inside the panel keeps it open. ## Placement [#placement] `placement` sets the side and the edge to line up with the trigger. | Value | Panel position | | --- | --- | | `bottom-start` | Below the trigger, left edges lined up. The default. | | `bottom-end` | Below the trigger, right edges lined up. | | `top-start` | Above the trigger, left edges lined up. | | `top-end` | Above the trigger, right edges lined up. | When the panel has no room on its side, it flips to the other side. It always stays 8px inside the window. It follows the trigger when the page scrolls or resizes. ```html ... ``` ## From code [#from-code] ```js const popover = document.querySelector('nsui-popover'); popover.show(); popover.hide(); popover.toggle(); popover.addEventListener('popovershow', () => console.log('opened')); popover.addEventListener('popoverhide', () => console.log('closed')); ``` `popoverhide` fires for every close: a trigger click, Escape, an outside click or `hide()`. ## Motion [#motion] The panel fades in and moves 4px toward its place in 140ms. It closes faster, in 100ms. A panel opened with the keyboard (Enter or Space on the trigger) does not animate. There is no motion when the system asks for reduced motion. ## Browser support [#browser-support] The Popover API needs Chrome 114, Firefox 125 or Safari 17. ## API [#api] # Record header (/docs/components/record-header) Use a record header to head one record in a purpose-built tool: the record type and number, its status, actions on the right, and a band of fields under it that the fold button shows or hides. Put a [field group](/docs/components/field-group) in the band and [totals](/docs/components/facts#totals) in the `aside` slot.
```html ```
## Status [#status] `status` is the text NetSuite reports. `status-tone` sets its colour and icon. The text always shows, so colour is never the only cue. | `status-tone` | Icon | Colour | | --- | --- | --- | | `info` | clock | info | | `success` | check circle | success | | `warning` | warning mark | warning | | `neutral` (default) | minus circle | muted |
```html ```
## Fold [#fold] The fold button hides or shows the band and the aside. They appear and disappear at once; only the chevron turns. `collapsed` is reflected. The `togglecollapse` event fires with `detail.collapsed` before the change, and `preventDefault()` keeps the current state. Setting `collapsed` from code fires no event. The band and the aside sit side by side, and stack when the header is narrower than 760px. ## Accessibility [#accessibility] - The header is a region named by its type and number: "Sales order SO51369". - The fold button is named "Hide sales order details" or "Show sales order details", and has `aria-expanded`. - Buttons in the `actions` slot keep their own names. Give icon buttons an `aria-label`. ## API [#api] # Select (/docs/components/select) Use a select to pick one value from a list. The list opens in a popover with NSUI's own styling, not the browser's menu. ```html ``` ## Options as data [#options-as-data] Set the `options` property to an array, or pass JSON in the `options` attribute. When `options` is set, the select ignores `