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

lwc-ui

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lwc-ui

Basic Components

  • 0.9.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

lwc-ui

Minimal UI Components for Prototypes. View Demo

Install

npm install lwc-ui

Components

Attention - ui-attention

<ui-attention variant="danger">
  <ui-icon slot="left" path="{mdiAlertOctagon}"></ui-icon>
  Attention danger text.
</ui-attention>
SlotComponents
leftui-icon
defaultText
rightui-icon

Badge - ui-badge

Work in Progress...

<ui-button>
  Button with Badge
  <ui-badge slot="right">42</ui-badge>
</ui-button>

Button - ui-button

<ui-button>
  <ui-icon slot="left" path="{mdiAccount}"></ui-icon>
  Account Button
</ui-button>
AttributeDefaultValues
blockfalsetrue, false
onclickn/aMouseEvent
activenullindex or ui-button name
onactiven/a{ detail: true }

ButtonGroup - ui-button-group

<ui-button-group>
  <ui-button>Button 1</ui-button>
  <ui-button>Button 2</ui-button>
</ui-button-group>
AttributeDefaultValues
blockfalsetrue, false
activenullindex or ui-button name
onactiven/a{ detail: { index: 0, name: null }}

Note: active must be set for onactive to trigger.

Card - ui-card

Cards can section content.

<ui-card>
  <ui-card-header>
    Header
  </ui-card-header>
  <ui-card-body>
    <p>Hello!</p>
  </ui-card-body>
  <ui-card-footer>
    Footer
  </ui-card-footer>
</ui-card>
AttributeDefaultValues
shadow00, 1, 2, 3

ContextMenu - ui-context-menu

Wrap any element to add a right click context menu.

<ui-context-menu>
  <div>Right Click Here</div>
  <ui-menu slot="menu">
    <ui-menu-item>Option 1</ui-menu-item>
  </ui-menu>
</ui-context-menu>
AttributeDefaultValues
placementbottom-startPopper Placement

Dropdown - ui-dropdown

This works the same as ui-picker but will display a caret on button elements that flips based on placement.

<ui-dropdown>
  <ui-button>Down</ui-button>
  <ui-menu slot="menu">
    <ui-menu-item>Option 1</ui-menu-item>
  </ui-menu>
</ui-dropdown>
AttributeDefaultValues
placementbottom-startPopper Placement

Note: The menu slot can be any element, but the most common will be ui-menu.

Form - ui-form

The form shold wrap any elements you plan to use. It will handle simple things like validation.

<ui-form oninit={handleFormInit} onsubmit={handleFormSubmit} onchange={handleFormChange}>
  <ui-label>
    Type Textarea
    <ui-input type="textarea" value={value}></ui-textarea>
  </ui-label>
  <ui-button submit>Submit Form</button>
</ui-form>
Componentui-input type=*Attributes
ui-input-texttextvalue, minlength, maxlength, pattern
ui-input-countercountervalue, step, min, max
ui-textareatextareavalue, minlength, maxlength, pattern
ui-input-numbernumbervalue, min, max, step
ui-input-passwordpasswordvalue, minlength

Icon - ui-icon

Use with the @mdi/js package which contains thousands of icons.

import { mdiAccount } from '@mdi/js';
// ...
@track mdiAccount: string = mdiAccount;
<ui-icon path="{mdiAccount}"></ui-icon>

List - ui-list

List is often used with the ui-card component.

<ui-list>
  <ui-list-header>Items</ui-list-header>
  <ui-list-item>Item 1</ui-list-item>
  <ui-list-separator></ui-list-separator>
  <ui-list-section>
    <ui-list-header>Additional Items</ui-list-header>
    <ui-list-item>
      <ui-icon slot="left" path="{mdiNumeric1}"></ui-icon>
      Item 2
    </ui-list-item>
  </ui-list-section>
</ui-list>

Menu - ui-menu

The menu can be used by itself or with ui-context-menu, ui-dropdown, and ui-picker.

<ui-menu>
  <ui-menu-item>Option 1</ui-menu-item>
  <ui-menu-separator></ui-menu-separator>
  <ui-menu-item>Option 2</ui-menu-item>
  <ui-menu></ui-menu
></ui-menu>

Modal - ui-modal

<ui-modal>
  <ui-modal-header>Title</ui-modal-header>
  <ui-modal-body>Content</ui-modal-body>
  <ui-modal-footer>
    <ui-button>Button</ui-button>
  </ui-modal-footer>
</ui-modal>

Picker - ui-picker

Exact same as ui-dropdown, but does not cause a inner ui-button to render a caret. Think date picker dropdown.

<ui-dropdown>
  <ui-button>Down</ui-button>
  <div slot="menu">
    This can be absolutely anything.
  </div>
</ui-dropdown>
AttributeDefaultValues
placementbottom-startPopper Placement

Toast - ui-toast

To use the toast service you must include one ui-toast component in the root of your app.

<ui-toast></ui-toast>
import {
  showToast,
  showWarningToast,
  showErrorToast,
  showLoadingToast,
  removeToast,
  removeAllToasts
} from `lwc-ui`;
// ...
var id = showToast('Saved');
showWarningToast('Ehh... could be worse', 3);
showErrorToast('No good.', 3);
showLoadingToast('Soon...', 3);
// Remove a specific toast
removeToast(id);
// Or remove all toasts
removeAllToasts();

Why?

Mostly using this to try out ideas in TypeScript.

Keywords

FAQs

Package last updated on 07 Oct 2019

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