Clay
Skip to ContentClayClay by Liferay
  • Get Started
    • Introduction
    • What is Clay
    • Importing the JS Component
    • Using JS Components with Metal.js
    • Web Components
  • Foundations
    • Grid
    • Typography
  • Lexicon Core Components
    • Alerts
    • Badges
    • Buttons
    • Cards
    • Charts
      • Advanced Examples
        • Axis Label
        • Axis Range
        • Data Color
        • Gridlines
        • Predictive forecasting
        • Regions
        • X Axis Tick Formatting
      • Basic Examples
        • Bar Chart
        • Bubble Chart
        • Combination Chart
        • Donut Chart
        • Gauge Chart
        • Geomap Chart
        • Line Chart
        • Pie Chart
        • Scatter Chart
        • Spline Chart
        • Step Chart
    • Dataset Display
    • Dropdown Menu
    • Forms
      • Checkbox, Radio, and Toggle
      • Forms
      • Forms Hierarchy
      • Forms Navigation
      • Multi Step Form
      • Multi Step Form Simplified
      • Selectors
      • Text Input
      • Text Input Group
      • Text Input Localizable
      • Text Input Variations
    • Icons
    • Labels
    • Link
    • List
    • Loading Indicator
    • Modals
    • Navigation
      • Breadcrumbs
      • Navigation Bar
      • Vertical Navigation
    • Pagination
    • Popovers and Tooltips
    • Progress Bars
    • Sidebar
      • Info Panel
    • Stickers
    • Table
      • Inline Edit Table
      • Table
    • Tabs
    • Toolbars
      • Management Toolbar
  • CSS Framework
    • SCSS
    • Class Helpers
    • Satellite Components
      • Alerts
      • Badges
      • Button Group
      • Cards
      • Dropdown Menu
      • Forms
        • Form Elements
        • Form Elements (Input Groups)
        • Form Elements (Validation)
      • Images (Aspect Ratios)
      • Images and Thumbnails
      • Labels
      • Links
      • List Groups
      • Modals
      • Nav
      • Navigation
        • Header
      • Paginations
      • Panels
      • Popovers and Tooltips
      • Progress Bars
      • Stickers
      • Tables
      • Tbar (Toolbar)
      • Timelines
      • Toggle Switch
    • Page Examples
      • Card View Template
      • Document Upload
      • List View Template
      • Table View Template
      • Users and Organizations
  • News

Importing the JS Component

Clay is available as the clay package in npm. The components are packaged as Component/Metal.js classes that provide a high fidelity component. You can import the Clay components in several ways depending on your Stack.

Installation from NPM

You can import the entire library of Clay components at once in your application, or you can import them individually as you need them.

  • All components - clay package on npm.
  • Separate components - clay- packages on npm.

All components

Using npm:

npm install clay --save

Or yarn:

yarn add clay

Separate components

Using npm:

npm install clay-badge --save

Or yarn:

yarn add clay-badge

ES2015

import {ClayBadge, ClayButton} from 'clay';

Manual Instantiation

You can render a Clay component on whatever element you want if you are not using a framework.

<div id="my-element"></div>

Import the component in your application and manually instantiate the component by passing the required properties and the id of the element.

import ClayBadge from 'clay-badge';

const badge = new ClayBadge(
    {
        label: 'My Badge'
    }, 
    '#my-element'
);

CDN

Once added to your page, the Clay components are accessible globally on the page with all components.

See Introduction.

<div id="element"></div>

<script type="text/javascript">
    var clayButton = new clay.ClayButton(
        {
            label: 'My Button'
        }, 
        '#element'
    );
</script>

Using Clay in soy and jsx

For more information see the advanced guides.

Except as otherwise noted, the content of this site is licensed under CC BY-SA 4.0 license.