Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmwc/list

Package Overview
Dependencies
Maintainers
1
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/list

RMWC List component

  • 3.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.8K
increased by25.16%
Maintainers
1
Weekly downloads
 
Created
Source

Lists

Lists are continuous, vertical indexes of text or images.

  • import from '@rmwc/list';
  • Import styles:
    • import '@material/list/dist/mdc.list.css';
  • MDC Docs: https://material.io/develop/web/components/lists/

ListItems can be verbose to import and render. A non-standard 'SimpleListItem' has been created to improve the developer experience which contains a default template for ListItems.

Standard Usage

import {
  List,
  ListItem
} from '@rmwc/list';

<List>
  <ListItem>Cookies</ListItem>
  <ListItem>Pizza</ListItem>
  <ListItem>Icecream</ListItem>
</List>

Simplified Usage

import {
  List,
  SimpleListItem
} from '@rmwc/list';

<List twoLine>
  <SimpleListItem graphic="star_border" text="Cookies" secondaryText="Chocolate chip" meta="info" />
  <SimpleListItem graphic="favorite_border" text="Pizza" secondaryText="Pepperoni" meta="info" />
  <SimpleListItem graphic="mood" text="Icecream" secondaryText="Chocolate cookie dough" meta="info" />
</List>

Two Line

When using the twoLine prop, you have to wrap the contents of the ListItem in ListItemText.

import {
  List,
  ListItem,
  ListItemText,
  ListItemPrimaryText,
  ListItemSecondaryText
} from '@rmwc/list';

<List twoLine>
  <ListItem>
    <ListItemText>
      <ListItemPrimaryText>Cookies</ListItemPrimaryText>
      <ListItemSecondaryText>$4.99 a dozen</ListItemSecondaryText>
    </ListItemText>
  </ListItem>
  <ListItem>
    <ListItemText>
      <ListItemPrimaryText>Pizza</ListItemPrimaryText>
      <ListItemSecondaryText>$1.99 a slice</ListItemSecondaryText>
    </ListItemText>
  </ListItem>
  <ListItem>
    <ListItemText>
      <ListItemPrimaryText>Icecream</ListItemPrimaryText>
      <ListItemSecondaryText>$0.99 a scoop</ListItemSecondaryText>
    </ListItemText>
  </ListItem>
</List>

Leading and Trailing Icons

import {
  List,
  ListItem,
  ListItemGraphic,
  ListItemMeta
} from '@rmwc/list';

<List>
  <ListItem>
    <ListItemGraphic icon="favorite"/>
    Leading
  </ListItem>
  <ListItem>
    Trailing
    <ListItemMeta icon="star"/>
  </ListItem>
  <ListItem>
    <ListItemGraphic icon="wifi"/>
    Leading and Trailing
    <ListItemMeta icon="info"/>
  </ListItem>
</List>

Avatar List with Dividers

import {
  List,
  ListGroup,
  ListDivider,
  ListItem,
  ListItemGraphic,
  ListItemMeta,
} from '@rmwc/list';

<List twoLine avatarList>
  <ListGroup>
    <ListItem>
      <ListItemGraphic icon="person" style={{backgroundColor: 'lightgray'}} />
      Bruce Wayne
      <ListItemMeta icon="info"/>
    </ListItem>
    <ListItem>
      <ListItemGraphic icon="person" style={{backgroundColor: 'coral'}} />
      Clark Kent
      <ListItemMeta icon="info"/>
    </ListItem>
  </ListGroup>
  <ListDivider />
  <ListGroup>
    <ListItem>
      <ListItemGraphic icon="person" style={{backgroundColor: 'lightblue'}} />
      Diana Prince
      <ListItemMeta icon="info"/>
    </ListItem>
  </ListGroup>
</List>

Selectable

import {
  List,
  ListItem,
  ListItemGraphic,
} from '@rmwc/list';

import { Checkbox } from '@rmwc/checkbox';

<List>
  <ListItem onClick={() => this.setState({cookiesChecked: !this.state.cookiesChecked})}>
    <ListItemGraphic icon={<Checkbox checked={this.state.cookiesChecked}/>}/>
    Cookies
  </ListItem>
  <ListItem onClick={() => this.setState({pizzaChecked: !this.state.pizzaChecked})}>
    <ListItemGraphic icon={<Checkbox checked={this.state.pizzaChecked}/>}/>
    Pizza
  </ListItem>
  <ListItem onClick={() => this.setState({iceCreamChecked: !this.state.iceCreamChecked})}>
    <ListItemGraphic icon={<Checkbox checked={this.state.iceCreamChecked}/>}/>
    Icecream
  </ListItem>
</List>
import { DocumentComponent } from '@rmwc/base/utils/document-component';
import * as docs from './docgen.json';

<DocumentComponent docs={docs} displayName="List" />
<DocumentComponent docs={docs} displayName="ListItem" />
<DocumentComponent docs={docs} displayName="ListItemPrimaryText" />
<DocumentComponent docs={docs} displayName="ListItemSecondaryText" />
<DocumentComponent docs={docs} displayName="ListItemGraphic" />
<DocumentComponent docs={docs} displayName="ListItemMeta" />
<DocumentComponent docs={docs} displayName="ListDivider" />
<DocumentComponent docs={docs} displayName="ListGroup" />
<DocumentComponent docs={docs} displayName="ListGroupSubheader" />
<DocumentComponent docs={docs} displayName="SimpleListItem" />

Keywords

FAQs

Package last updated on 02 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc