OverviewInstallationMigrating to 1.0Themes and layersKanok designCustomizingIconsForms and validationFrameworksUsing with AIButtonText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderModalSide panelTearsheetNotificationToastTooltipDefinition tooltipPopoverToggletipMenuData tableStructured listPaginationContained listTree viewTabsBreadcrumbLinkPagination navContent switcherAccordionProgress indicatorUI shellTagTileCardProduct cardCode snippetCopy buttonUser avatarTruncated textListLoadingInline loadingProgress barSkeletonBadge indicatorStatus indicatorGridHeadingLayerAction setPage headerBig numberEdit in placeIntroductionText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderTabsPagination navContent switcherTooltipDefinition tooltipPopoverMenuAccordionProgress indicatorUI shellModalSide panelTearsheetNotificationToastData tableStructured listPaginationTree viewCode snippetCopy buttonTruncated textLoadingTagCardProduct cardEdit in place
Contained list
A contained list is a titled list of rows separated by thin rules, for settings panels, side panels and tiles (Carbon ContainedList). A row can carry an icon and an action, or be a button itself.
Service agreement.pdfAppendix A – Price list.pdfPower of attorney.pdf
npmshadcn · Web componentshadcn · React + TailwindManualnpminstall@purpurabog/uinpxshadcn@4add@kanok-ui/contained-listnpxshadcn@4add@kanok-ui/tw-contained-list# Web component# 1. Install the dependenciesnpminstalllit@^3.3.0# 2. Copy each file's "content" from# https://cdn.jsdelivr.net/npm/@purpurabog/ui@2.3.0/registry/contained-list.json# to its target:# components/ui/primitives/contained-list/contained-list-item.ts# components/ui/primitives/contained-list/contained-list.ts# 3. Do the same for the items it needs (registry/<name>.json):# shared-element, shared-field, shared-slots, tokens# React + Tailwind# 1. Install the dependencies# (none)# 2. Copy each file's "content" from# https://cdn.jsdelivr.net/npm/@purpurabog/ui@2.3.0/registry/tw-contained-list.json# to its target:# components/ui/react-tw/contained-list.tsx# 3. Do the same for the items it needs (registry/<name>.json):# tw-theme, tw-utils
npm gives you every component from the package. shadcn copies the source into your app instead: a copy pinned to this version that you can change. The shadcn commands need the @kanok-ui registry in your components.json once, see Installation.
kind="on-page" (the default) has a 48px header in the heading style, on the page background. kind="disclosed" has a small 32px label on the layer: use it inside a tile, a side panel or under a disclosure. On-page lists that follow each other sit 16px apart.
Anan P., Managing directorKanya S., Legal counselFinance department
The action slot (action in React + Tailwind) holds a control at the row's end, such as a small icon button. It stays a control of its own: pressing it doesn't press the row. Here Remove takes the row out.
Service agreement.pdf
Appendix A.pdf
Appendix B.pdf
React + Tailwind centres the action in the row by itself, so the tag only needs the end margin.
Clickable rows
clickable makes the whole row a button: it fires ui-click when pressed (onClick in React + Tailwind makes the row a button). disabled greys a clickable row out.
Service agreement.pdfAppendix A.pdfDraft – being edited by Kanya S.
Opened:
HTMLReactReact + Tailwind<divstyle="max-width: 480px">
<ui-contained-listid="contained-list-open"label="Open a document">
<ui-contained-list-itemclickable>Service agreement.pdf</ui-contained-list-item>
<ui-contained-list-itemclickable>Appendix A.pdf</ui-contained-list-item>
<ui-contained-list-itemclickabledisabled>Draft – being edited by Kanya S.</ui-contained-list-item>
</ui-contained-list>
</div>
<p>Opened: <outputid="contained-list-open-out"></output></p>
<scripttype="module">
const list = document.getElementById('contained-list-open');
const out = document.getElementById('contained-list-open-out');
list.addEventListener('ui-click', (event) => (out.value = event.target.textContent.trim()));
</script>const [opened, setOpened] =useState('');
<UiContainedListlabel="Open a document">
<UiContainedListItemclickableonUiClick={() =>setOpened('Service agreement.pdf')}>Service agreement.pdf</UiContainedListItem>
<UiContainedListItemclickableonUiClick={() =>setOpened('Appendix A.pdf')}>Appendix A.pdf</UiContainedListItem>
<UiContainedListItemclickabledisabled>Draft – being edited by Kanya S.</UiContainedListItem>
</UiContainedList>
<p>Opened: <output>{opened}</output></p>const [opened, setOpened] =useState('');
<ContainedListlabel="Open a document">
<ContainedListItemonClick={() =>setOpened('Service agreement.pdf')}>Service agreement.pdf</ContainedListItem>
<ContainedListItemonClick={() =>setOpened('Appendix A.pdf')}>Appendix A.pdf</ContainedListItem>
<ContainedListItemonClick={() =>setOpened('Draft')} disabled>Draft – being edited by Kanya S.</ContainedListItem>
</ContainedList>
<p>Opened: <output>{opened}</output></p>
A clickable row can still have an action: the action stays a separate button beside it.
Search in the header
The header's action slot also takes a search. An expandable search stays a magnifier until it is pressed. Filter the rows yourself as the user types.
Beyond Carbon: current on a row marks the one the user is on, with the side nav's "you are here" look (a fill and a bar on the start edge, aria-current). current on a list marks it among several, such as the board on screen: its header takes the same fill and bar.
The rows are a role="list" of listitems, named by the header label (aria-labelledby). React + Tailwind renders a real <ul> and <li>s.
A clickable row is a native <button>: Tab reaches it, Enter and Space press it. A disabled row is skipped.
Name every icon-only action with its row, for example "Remove Appendix A.pdf", so the buttons differ for screen reader users.
The header stays at the top while the list scrolls in a box (position: sticky).
API
Generated from the package. In React, pass a property as a prop of the same name; events are props too (the React column).
<ui-contained-list> · React UiContainedList
Attributes
Attribute
Property
Type
Default
Description
label
label
string
''
kind
kind
ContainedListKind
'on-page'
size
size
ContainedListSize
'lg'
inset
inset
boolean
false
Rules stop at the row padding instead of running edge to edge (Carbon isInset).
current
current
boolean
false
Beyond Carbon: the list the user is on, among several (aria-current="true" on the list, the side nav's fill and bar on the header).
Slots
Slot
Description
(default)
<ui-contained-list-item> elements
label
Rich label
action
Header action (search, icon button)
CSS parts
Part
Description
header
The sticky header row
label
The label
action
The header action wrapper
list
The role=list container
CSS custom properties
Custom property
Default
Description
--ui-nav-current-mark
/ --ui-nav-current-mark-width / --ui-nav-current-mark-inset / --ui-nav-current-mark-radius - The current list's header bar, the side nav's settings (default primary, 3px, 0, 0); --ui-nav-current-background its fill (default --ui-canvas-selected)
Beyond Carbon: the row the user is on (aria-current="true", the side nav's current-page look).
Events
Event
React
Description
ui-click
onUiClick
Clickable rows, when activated
Slots
Slot
Description
(default)
Row content
icon
16px icon
action
Trailing action
CSS parts
Part
Description
content
The row body (a button when clickable)
action
The action wrapper
CSS custom properties
Custom property
Default
Description
--ui-nav-current-background
/ --ui-nav-current-mark - The current row's fill and start bar, the side nav's settings (default canvas-selected, primary; Kanok: the highlight tint, no bar)
--ui-nav-current-mark-width
/ --ui-nav-current-mark-inset / --ui-nav-current-mark-radius - The bar's width (3px), top and bottom inset (0) and corners (0)