List

A list of rows with leading, body and trailing slots.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrList, WrListItem } from 'ngwr/list';

@Component({ imports: [WrList, WrListItem] })
export class MyComponent {}

Playground

    📁 Reports 12📁 Invoices 4📁 Customers 128📁 Settings —🔒 Archived —
<wr-list bordered dividers >
  <wr-list-item interactive>
    <span ngProjectAs="[wrListItemLeading]">📁</span>
    Reports
    <span ngProjectAs="[wrListItemTrailing]">12</span>
  </wr-list-item>
</wr-list>

Customize

Bordered
Dividers
Dense
Interactive rows

API

NameDescriptionTypeDefault
<wr-list>Container. Renders <ul role="list">.component—
borderedCard-style border and radius.booleanfalse
dividersThin border between consecutive items.booleanfalse
denseCompact vertical padding.booleanfalse
ariaLabelOptional accessible label for the list.string''
<wr-list-item>Row with three projection slots: [wrListItemLeading], default body, [wrListItemTrailing].component—
interactiveHover state, a tab stop and Enter / Space activation.booleanfalse
disabledDims the row and blocks interaction.booleanfalse

CSS variables

Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/list's own element.

VariableDefaultDeclared on
--wr-list-active-bgcolor-mix(in srgb, var(--wr-color-primary) 8%, transparent).wr-list
--wr-list-bgtransparent.wr-list
--wr-list-divider-colorvar(--wr-border-base).wr-list
--wr-list-font-familyvar(--wr-font-family-base).wr-list
--wr-list-font-sizevar(--wr-text-sm).wr-list
--wr-list-hover-bgvar(--wr-color-hover).wr-list
--wr-list-item-gapvar(--wr-space-md).wr-list
--wr-list-item-padding-xvar(--wr-space-lg).wr-list
--wr-list-item-padding-yvar(--wr-space-md).wr-list +1 variant override
--wr-list-radiusvar(--wr-border-radius-base).wr-list

See also