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

Using JS Components with Metal.js

Clay Components are made according to Lexicon standards and built on top of the Metal.js framework. This means that you can use Clay Components in your JSX and SOY templates.

Jsx

You can import your components as described in Importing the JS Component. Consider the example below:

import {ClayBadge} from 'clay';

You can call Clay components in your JSX templates just like you would call Metal.js components:

import Component from 'metal-jsx';
import {ClayBadge} from 'clay';

class App extends Component {
    render() {
        return(
            <div>
                <h4>My Application with Clay<h4>
                <hr />
                <ClayBadge
                    id="myId"
                    label="badge"
                    style="danger"
                />
            </div>
        );
    }
};

Soy

You can call Clay components in your SOY templates the same way you would call any SOY component. Consider the example below:

Warning: Make sure you import the Clay component where you want to use it.
import Component from 'metal-component';
import Soy from 'metal-soy';

import {ClayBadge} from 'clay';

class App extends Component {}

// more...
{namespace App}

{template .render}
    {call ClayBadge.render}
        {param id: 'myId' /}
        {param label: 'badge' /}
        {param style: 'danger' /}
    {/call}
{/template}

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