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.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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.

Flex - ui-flex

Flex layout helper tags.

<ui-flex>
  <ui-flex flex="1">Column 1 (flex=1)</ui-flex>
  <ui-flex flex="2">Column 2 (flex=2)</ui-flex>
  <ui-flex>Column 3 (flex=content)</ui-flex>
</ui-flex>
AttributeDefaultValues
flexcontentUsually an integer
columnflex-direction: column
rowflex-direction: row

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
ui-input-syntaxsyntaxvalue, parts

Input Syntax

This is a text input with auto complete.

@track

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-item>Option 3</ui-menu-item>
</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

Tab - ui-tab

The ui-tab creates tabs using the existing ui-nav and ui-nav-item elements.

<ui-tab>
  <ui-nav>
    <ui-nav-item>
      Basic Tab 1
    </ui-nav-item>
    <ui-nav-item>
      Basic Tab 2
    </ui-nav-item>
  </ui-nav>
  <ui-tab-item>
    Basic Tab 1 content
  </ui-tab-item>
  <ui-tab-item>
    Basic Tab 2 content
  </ui-tab-item>
</ui-tab>

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();

Tree - ui-tree

<ui-tree folder={isFolder}>
  <ui-tree-item>
    Item 1
    <ui-tree-item-group>
      <ui-tree-item>
        Sub Item 1
      </ui-tree-item>
      <ui-tree-item>
        <ui-icon path={mdiFile}></ui-icon>
        Sub Item 2
      </ui-tree-item>
    </ui-tree-item-group>
  </ui-tree-item>
</ui-tree>
AttributeDefaultValues
variantdefaultdefault, chevron, folder

Why?

Mostly using this to try out ideas in TypeScript.

Keywords

FAQs

Package last updated on 30 Nov 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