Tabs
Tab bar with one visible panel.
Use tabs to split a record into sections, like the subtabs on a NetSuite record.
Selecting a tab
value is the name of the selected tab. When value is empty or matches no tab, the first tab is selected. A tab with no name gets tab-1, tab-2 and so on, by position. A tab with no label shows its name.
Count
Add count to an nsui-tab to show a number pill next to the label.
Keyboard
Left and Right move to the previous and next tab. Home and End move to the first and last tab.
Tab change event
nsui-tabs fires tabchange when the user selects a tab. event.detail.value is the new tab name. It does not fire when you set value from code.
The event is not named change on purpose: nsui-input, nsui-select and nsui-checkbox fire change, and those events bubble up through the tabs. A separate name keeps tab switches and field edits apart.
document.querySelector('nsui-tabs').addEventListener('tabchange', (e) => {
console.log(e.detail.value);
});In JSX (NSUI's h(), React 19 or Preact): <nsui-tabs ontabchange={(e) => ...}>.
Document tabs
Use variant="document" for records that are open at the same time, like files in an editor. The tabs are folder tabs: the selected tab joins the card below it, and the others tuck behind the tab on their left.
labelis the record number andsublabelthe name. When the tabs do not fit, names shorten with an ellipsis, then the strip scrolls sideways.count-tone="edited"shows the count with an amber ring, for unsaved edits. Screen readers hear "6 unsaved edits".- Put buttons after the tabs with
slot="end".
Closing a tab
closable adds a close button. Delete on the focused tab closes it too. nsui-tabs first fires tabclose with detail.value, the tab's name. Call preventDefault() to keep the tab, for example to ask before closing a record with unsaved edits. Otherwise the tab is removed. If it was selected, the tab to its right is selected (or the one to its left), and tabchange fires.
tabs.addEventListener('tabclose', (e) => {
const tab = tabs.querySelector(`nsui-tab[name="${e.detail.value}"]`);
if (tab.count && !confirm(`Discard ${tab.count} unsaved edits?`)) e.preventDefault();
});API
nsui-tabs
Attributes
Prop
Type
Events
Prop
Type
Slots
Prop
Type
CSS parts
Prop
Type
nsui-tab
Attributes
Prop
Type
Slots
Prop
Type
Settings
Settings page with a section rail, rows with fixed lanes and a save bar.
Timeline
A record's change history as a small git-style graph.
NSUI is a community project. It is not an official Oracle NetSuite product. NetSuite is a trademark of Oracle.