Overview
Framework and Utilities
Angular
React
Vue
Blazor
Integrations
Roadmap
Release Notes
Accessibility
Theme Builder
Grid
Gantt Chart
Scheduler
CardView
Chart
Editor
DockingLayout
Kanban
PivotTable
Table
Accordion
Badge
Barcode
Button
Breadcrumb
Card
Carousel
Calendar
CheckBox
ComboBox
ColorPicker
DateTimePicker
DropDownList
DropDownButton
FileUpload
Form
Gauge
Input
ListBox
ListMenu
Layout
MaskedTextBox
Menu
MultilineTextBox
MultiSplitButton
NumericTextBox
Pager
PasswordTextBox
PowerButton
ProgressBar
QueryBuilder
RadioButton
Rating
RepeatButton
Ribbon Bar
Qrcode
ScrollBar
Slider
Splitter
SwitchButton
Sortable
Tabs
Tank
TextBox
TimePicker
Toast
ToggleButton
Tooltip
Tree
Window
Create a Custom Element
View Model Binding
Data Adapter
Data Exporter
Conditional Formatter
Shadow Dom
Router
Validator
Date API
Numeric API
Drawing API
Localization
Comparison with Others
Overview
WAI-ARIA Support
Section 508 Support
WCAG Compliance
Keyboard Shortcuts
Right-to-left Languages
Overview
Using with Angular
Component NPM packages
Template-driven Forms
Forms Custom Validation
Reactive Forms
Angular Signals
Angular Universal - Server side Rendering
Angular Grid
Angular Grid Data Service
NGX Translate Grid
Angular Grid Refresh Data Source
ngFor Directive
Angular HTTP and Grid CRUD
Dynamic Forms
Form Numeric Validation
Notification Angular Service
Angular routing with Tabs
Angular routing with Splitter
Angular routing with Accordion
Angular Component in Grid column
Refresh Grid data source
Dynamic Components in Tabs
Dynamic Table with ng-for
Angular Debug with VS Code
Angular RxJS
Angular RxJS Server Paging
Angular Azure Face API
Angular Azure Cosmos DB
Angular Electron with Grid
Angular Grid Editing with Form
Angular Grid as Standalone
Angular Gantt as Standalone
Angular Scheduler as Standalone
Using with React
React with Typescript
Using the state Hook
React Grid
NextJS & Grid
Next JS with SSR
Vite
React Kanban Remote data
React Scheduler & MySQL
React Scheduler & MongoDB
React Grid Remote Data
React Grid Edit with Form
React Grid Styling
React Grid CRUD
React Hooks in Grid
React Components in Grid cells
React Grid CRUD with Express JS and MySQL
React Grid and GraphQL
Using with Vue 3
Using with Vue 3 & Typescript
Using with Vue 3 Composition API
Using with Vue 2
Using ListBox with Vue 2
Vue Routing
Vue Grid Data Bind
Using with Blazor & .NET 8, 9
Using with Blazor & .NET 5, 6, 7
Using Blazor with JS Components
Two-way Binding
Localization
Adding to Toolbox
Web Assembly CRUD Application
PWA Application
Desktop Application
.NET MAUI & Blazor
Full-stack app with GraphQL
Full-stack app with GraphQL(2)
Blazor CardView
Setup CardView
Cardview Editing
Cardview Scroll
Blazor Chart
Setup Chart
Chart Axes
Chart Formatting
Chart Polar/Spider
Chart Types
Blazor Editor
Setup Editor
Editor Find & Replace
Editor Inline toolbar
Editor markdown
Editor methods
Editor Paste format
Editor toolbar
Editor toolbar items
Custom toolbar items(JSInterop)
Editor Image Upload
Blazor Docking Layout
Blazor Gantt
Setup Gantt
Gantt Data Bind
Gantt Data Bind to JSON
Gantt events
Gantt export
Gantt header
Gantt nonworking-time
Gantt resources
Gantt Customization
Gantt Timeline
Gantt Custom Header(JSInterop)
Blazor Grid
Setup Grid
Grid Column Menu
Grid Columns Bind
Grid Columns Command Menu
Grid Columns Format
Grid Columns Freeze
Grid Columns Group
Grid Columns Reorder
Grid Columns Resize
Grid Data Bind to CSV
Grid Data Bind to Enumerable
Grid Data Bind to JSON
Grid Data Bind to SQL
Grid Data Bind to Web API
Grid Events
Grid Export
Grid Editing
Grid Filter
Grid Grouping
Grid Paging
Grid Refresh Data
Grid Selection
Grid Server side Crud
Localization
OData binding
Dynamic Template(JSInterop)
Custom Editor
Custom Tooltips
Blazor Inputs
Button
Switch Button
Radio Button
Repeat Button
Dropdown Button
Toggle Button
Progress Bar
Checkbox
Card
Check Input
Multicombo Input
Multi Input
Number Input
Numeric Textbox
Date/Time Picker
Date Range Input
Date Input
Calendar
Slider
Masked TextBox
Password TextBox
File Upload
File Upload handle Files
Dropdownlist
Dropdownlist with Label & Value
Combobox
Combobox with Label & Value
Color Picker
Time Picker
Tank
Blazor Kanban
Setup Kanban
Kanban Nested columns
Kanban SQL bind
Kanban Server Side CRUD
Blazor Pivot
Setup Pivot Table
Pivot Table Columns
Pivot Table Designer
Pivot Table Export
Pivot Table Toolbar
Pivot Table Totals
Blazor Scheduler
Setup Scheduler
Scheduler Agenda view
Scheduler Data Bind to JSON
Scheduler Day View
Scheduler Edit Events
Scheduler Month View
Scheduler Timeline Day View
Scheduler Timeline Month View
Scheduler Timeline Week View
Scheduler Views
Scheduler Week View
Scheduler Custom Footer(JSInterop)
Scheduler SQL bind
Scheduler Server Side CRUD
Blazor Table
Setup Table
Table Change Columns
Table Column Hierarchy
Table Header and Footer
Table Selection
Blazor Accordion
Blazor Tabs
Blazor Tree
Blazor Form
Blazor Form Value Handling
Blazor Query Builder
Blazor ListMenu
Blazor Toast
Blazor Pager
Blazor Menu
Blazor Gauge
Blazor Sortable
Blazor Carousel
Blazor Window
Misc
Tabs Selection
Hide Calendar Weekends
API
Accordion API
Accordion Item API
Button API
Button group API
Breadcrumb API
Card API
Cardview API
Carousel API
Color input API
Country input API
Color picker API
Combobox API
Calendar API
Dropdown list API
Date/time picker API
Date range input API
Date input API
Docking layout API
Dropdown button API
Editor API
File upload API
Form API
Form control API
Form group API
Gantt API
Gauge API
Grid API
Input API
Kanban API
Layout API
Layout group API
Layout item API
List box API
List item API
Masked textbox API
Menu API
Menu item API
Menu items group API
Multi combo input API
Multi input API
Numeric input API
Numeric textbox API
Pager API
Password input API
Password textbox API
Pivot Table API
Phoneinput API
Progressbar API
Query Builder API
Radio Button API
Rating API
Scheduler API
Scrollbar API
Slider API
Splitter API
Tank API
Textbox API
Textarea API
Tabs API
Toast API
TimeInput API
TimePicker API
Tree API
TreeItem API
Window API
Using with Typescript
Using with Lit Element
Using with Sharepoint
Using with PHP & MYSQL
Using with Meteor
Using with Ionic
Using with Stencil
Using Smart.Window with Stencil
Using with Svelte
Using with Electron
Using with Azure Cosmos DB
Using Firebase & OAuth2
Using with AWS DynamoDB
Using with NX(Angular & React)
Using with Webpack
Build ES6 modules with Webpack
Overview
Accessibility
CSS Styling
API
Overview
CSS Styling
Overview
Chart Styling
Chart Formatting
Chart Axes
Chart Types
API
3D Chart Axes
3D Chart Formatting
3D Chart Controls
3D Chart Styling
3D Chart Types
3D Chart API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Editor Toolbar
Context Menu
Auto Save
Iframe mode
Find & Replace
Editor Methods
Markdown
Dialogs
Video
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Data bind
Column definitions
Column headers
Column reorder
Context menu
Row Filtering
Row Freeze
Row IDs
Row Reorder
Row Resize
Row Sort
Row Span
Header & Footer
Editing
Cell Editing
Cell Templates
Filtering & Sorting
Grouping
Grouping: Expanding Groups
Paging
Nested Grids
Tree Grid
Rows & Columns
Get Row or Cell
Cascading Cell Editors
Conditional Row Select
Export
Export: Selected Records
Firebase & OAuth2
Using with AWS DynamoDB
Using with NodeJS and MySQL
Scrolling
Selection
Accessibility
Localization
Multi users support
Smart.Grid vs Smart.Table
CSS Styling
Appearance
Formulas
Styling Cells
Styling Rows
API
Overview
Gantt Editing
Gantt Sorting
Gantt Filtering
Gantt Tasks Tree
Gantt Timeline
Gantt Backend Storage
Gantt Resource Management
Gantt Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
MultiInput API
CheckInput API
MultiComboInput API
NumberInput API
DateInput API
DateRangeInput API
TimeInput API
ColorInput API
TextArea API
API
Overview
Accessibility
Kanban Complex layouts
Kanban Editing Customization
Kanban User comments
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
Query Parser
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
CSS Styling
API
Overview
CSS Styling
API
Overview
Current Time Indicator
Drag & Resize Events
Scheduler Events
Google Calendar Sync
Google Calendar Import/Export
Custom Header
Import & Export Events
Menus
Methods
Resources & Grouping
Time table
Time zones
Views
Windows
Signal R Integration
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Overview
Accessibility
CSS Styling
API
Smart.Button represents a simple button that can be clicked.
Smart UI for Web Components is distributed assmart-webcomponents NPM package
npm install smart-webcomponents
<script type="module" src="node_modules/smart-webcomponents/source/modules/smart.button.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/smart-webcomponents/source/styles/smart.default.css" />
<smart-button id="button"></smart-button>
<script type="module">Smart('#button', class {get properties() {return {"type":"submit"}}});</script>
const button = document.createElement('smart-button');button.disabled = true;document.body.appendChild(button);
import "../../source/modules/smart.button.js";document.readyState === 'complete' ? init() : window.onload = init;function init() { const button = new Smart.Button('#button', {"type":"submit"});}
The following code adds a simple button to the page.
<!DOCTYPE html><html lang="en"><head> <link rel="stylesheet" href="../../source/styles/smart.default.css" type="text/css" /></head><body> <smart-button>Click me</smart-button> <script type="module" src="../../source/modules/smart.button.js"></script></body></html>
Note howsmart.element.js andwebcomponents.min.js are declared before everything else. This is mandatory for all custom elements.
If the user wants to change the content of the button, this can be accomplished by setting theinnerHTML property of the element, like so:
<!DOCTYPE html><html lang="en"><head> <link rel="stylesheet" href="../../source/styles/smart.default.css" type="text/css" /> <script> window.onload = function () { document.querySelector('smart-button').innerHTML = 'Button 1'; } </script></head><body> <smart-button>Click Me</smart-button> <script type="module" src="../../source/modules/smart.button.js"></script></body></html>
Using theinnerHTML property the user can change the content of the element dynamically as well.
By default theinnerHTML of the button is an empty string.
The element offers multiple click modes:
clickMode is a property of the button that can be changed either from the HTML tag by setting the attributeclick-mode and assigning a new value to it or by following the earlier approach and change it dynamically via javascript during theonload stage of the window object or later.
Here's how to set a new click mode on element initialization:
<!DOCTYPE html><html lang="en"><head> <link rel="stylesheet" href="../../source/styles/smart.default.css" type="text/css" /></head><body> <smart-button click-mode="release">Click Me</smart-button> <script type="module" src="../../source/modules/smart.button.js"></script></body></html>
And here's how to change it via javascript after the element has been initialized:
<!DOCTYPE html><html lang="en"><head> <link rel="stylesheet" href="../../source/styles/smart.default.css" type="text/css" /> <script> window.onload = function () { document.querySelector('smart-button').clickMode = 'pressAndRelease'; } </script></head><body> <smart-button>Click Me</smart-button> <script type="module" src="../../source/modules/smart.button.js"></script></body></html>
const button = document.createElement('smart-button');
document.body.appendChild(button);
button.parentNode.removeChild(button);
button.propertyName = propertyValue;
const propertyValue = button.propertyName;
button.methodName(argument1, argument2);
const eventHandler = (event) => { // your code here.};button.addEventListener(eventName, eventHandler);
button.removeEventListener(eventName, eventHandler, true);
Smart Web Components package includes TypeScript definitions which enables strongly-typed access to the Smart UI Components and their configuration.
Inside the download package, the typescript directory contains .d.ts file for each web component and a smart.elements.d.ts typescript definitions file for all web components. Copy the typescript definitions file to your project and in your TypeScript file add a reference tosmart.elements.d.ts
Read more about using Smart UI with Typescript.Angular provides the easiest way to set angular CLI projects using Angular CLI tool.
Install the CLI application globally to your machine.
npm install -g @angular/cli
ng new smart-angular-button
Navigate to the created project folder
cd smart-angular-button
Smart UI for Angular is distributed assmart-webcomponents-angular NPM package
npm install smart-webcomponents-angular
import { NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { ButtonModule } from 'smart-webcomponents-angular/button';import { AppComponent } from './app.component';@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, ButtonModule ], bootstrap: [ AppComponent ]})export class AppModule { }
@import 'smart-webcomponents-angular/source/styles/smart.default.css';
"styles": ["node_modules/smart-webcomponents-angular/source/styles/smart.default.css"]
<div class="demo-horizontal-layout"> <div> <label>Default Buttons</label> <div class="demo-buttons-group"> <smart-button>Normal</smart-button> <smart-button #button class="raised">Raised</smart-button> <smart-button #button2 class="outlined">Outlined</smart-button> <smart-button #button3 class="flat">Flat</smart-button> <smart-button #button4 class="floating"><span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i class="material-icons"></i></span> </smart-button> </div> </div> <div> <label>Primary Buttons</label> <div class="demo-buttons-group"> <smart-button #button5 class="primary">Normal</smart-button> <smart-button #button6 class="raised primary">Raised</smart-button> <smart-button #button7 class="outlined primary">Outlined</smart-button> <smart-button #button8 class="flat primary">Flat</smart-button> <smart-button #button9 class="floating primary"><span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i class="material-icons"></i></span> </smart-button> </div> </div> <div> <label>Secondary Buttons</label> <div class="demo-buttons-group"> <smart-button #button10 class="secondary">Normal</smart-button> <smart-button #button11 class="raised secondary">Raised</smart-button> <smart-button #button12 class="outlined secondary">Outlined</smart-button> <smart-button #button13 class="flat secondary">Flat</smart-button> <smart-button #button14 class="floating secondary"><span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i class="material-icons"></i></span> </smart-button> </div> </div> <div> <label>Success Buttons</label> <div class="demo-buttons-group"> <smart-button #button15 class="success">Normal</smart-button> <smart-button #button16 class="raised success">Raised</smart-button> <smart-button #button17 class="outlined success">Outlined</smart-button> <smart-button #button18 class="flat success">Flat</smart-button> <smart-button #button19 class="floating success"><span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i class="material-icons"></i></span> </smart-button> </div> </div> <div> <label>Error Buttons</label> <div class="demo-buttons-group"> <smart-button #button20 class="error">Normal</smart-button> <smart-button #button21 class="raised error">Raised</smart-button> <smart-button #button22 class="outlined error">Outlined</smart-button> <smart-button #button23 class="flat error">Flat</smart-button> <smart-button #button24 class="floating error"><span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i class="material-icons"></i></span> </smart-button> </div> </div></div>
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';import { ButtonComponent } from 'smart-webcomponents-angular/button';@Component({ selector: 'app-root', templateUrl: './app.component.html',styleUrls: ['./app.component.css']})export class AppComponent implements AfterViewInit, OnInit {ngOnInit(): void {// onInit code.}ngAfterViewInit(): void {// afterViewInit code.this.init(); }init(): void {// init code. }}
import { NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { ButtonModule } from 'smart-webcomponents-angular/button';import { AppComponent } from './app.component';@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, ButtonModule ], bootstrap: [ AppComponent ]})export class AppModule { }
After completing the steps required to render a Button, run the following command to display the output in your web browser
ng serveand open localhost:4200 in your favorite web browser.
Read more about using Smart UI for Angular:https://www.htmlelements.com/docs/angular-cli/.
The easiest way to start with React is to usecreate-react-app. To scaffold your project structure, follow theinstallation instructions.
npx create-react-app my-appcd my-appnpm start
Opensrc/App.js andsrc/App.css
<div className="App"> </div>
Smart UI for React is distributed assmart-webcomponents-react NPM package
npm install smart-webcomponents-react
import 'smart-webcomponents-react/source/styles/smart.default.css';import React from "react";import ReactDOM from 'react-dom/client';import { Button, RepeatButton, ToggleButton, PowerButton } from 'smart-webcomponents-react/button';class App extends React.Component {componentDidMount() {}render() {return (<div> <div className="demo-horizontal-layout"> <div> <label>Default Buttons</label> <div className="demo-buttons-group"> <Button >Normal</Button> <Button className="raised">Raised</Button> <Button className="outlined">Outlined</Button> <Button className="flat">Flat</Button> <Button className="floating"><span className="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i className="material-icons"></i></span> </Button> </div> </div> <div> <label>Primary Buttons</label> <div className="demo-buttons-group"> <Button className="primary">Normal</Button> <Button className="raised primary">Raised</Button> <Button className="outlined primary">Outlined</Button> <Button className="flat primary">Flat</Button> <Button className="floating primary"><span className="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i className="material-icons"></i></span> </Button> </div> </div> <div> <label>Secondary Buttons</label> <div className="demo-buttons-group"> <Button className="secondary">Normal</Button> <Button className="raised secondary">Raised</Button> <Button className="outlined secondary">Outlined</Button> <Button className="flat secondary">Flat</Button> <Button className="floating secondary"><span className="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i className="material-icons"></i></span> </Button> </div> </div> <div> <label>Success Buttons</label> <div className="demo-buttons-group"> <Button className="success">Normal</Button> <Button className="raised success">Raised</Button> <Button className="outlined success">Outlined</Button> <Button className="flat success">Flat</Button> <Button className="floating success"><span className="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i className="material-icons"></i></span> </Button> </div> </div> <div> <label>Error Buttons</label> <div className="demo-buttons-group"> <Button className="error">Normal</Button> <Button className="raised error">Raised</Button> <Button className="outlined error">Outlined</Button> <Button className="flat error">Flat</Button> <Button className="floating error"><span className="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon"><i className="material-icons"></i></span> </Button> </div> </div> </div></div>);}}export default App;
npm startandopen localhost:3000 in your favorite web browser to see the output.
Read more about using Smart UI for React:https://www.htmlelements.com/docs/react/.
We will use vue-cli to get started. Let's install vue-cli
npm install -g @vue/cli
Then we can start creating our Vue.js projects with:
vue create my-project
Open the "my-project" folder and run:
npm install smart-webcomponents
Make Vue ignore custom elements defined outside of Vue (e.g., using the Web Components APIs). Otherwise, it will throw a warning about an Unknown custom element, assuming that you forgot to register a global component or misspelled a component name.
Open vite.config.js in your favorite text editor and change its contents to the following:import { fileURLToPath, URL } from 'node:url'import { defineConfig } from 'vite'import vue from '@vitejs/plugin-vue'// https://vitejs.dev/config/export default defineConfig({ plugins: [ vue({ template: { compilerOptions: { isCustomElement: tag => tag.startsWith('smart-') } } }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }})
<template> <div class="vue-root"> <div class="demo-horizontal-layout"> <div> <label>Default Buttons</label> <div class="demo-buttons-group"> <smart-button>Normal</smart-button> <smart-button class="raised">Raised</smart-button> <smart-button class="outlined">Outlined</smart-button> <smart-button class="flat">Flat</smart-button> <smart-button class="floating"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" > <i class="material-icons"></i> </span> </smart-button> </div> </div> <div> <label>Primary Buttons</label> <div class="demo-buttons-group"> <smart-button class="primary">Normal</smart-button> <smart-button class="raised primary">Raised</smart-button> <smart-button class="outlined primary">Outlined</smart-button> <smart-button class="flat primary">Flat</smart-button> <smart-button class="floating primary"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" > <i class="material-icons"></i> </span> </smart-button> </div> </div> <div> <label>Secondary Buttons</label> <div class="demo-buttons-group"> <smart-button class="secondary">Normal</smart-button> <smart-button class="raised secondary">Raised</smart-button> <smart-button class="outlined secondary">Outlined</smart-button> <smart-button class="flat secondary">Flat</smart-button> <smart-button class="floating secondary"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" > <i class="material-icons"></i> </span> </smart-button> </div> </div> <div> <label>Success Buttons</label> <div class="demo-buttons-group"> <smart-button class="success">Normal</smart-button> <smart-button class="raised success">Raised</smart-button> <smart-button class="outlined success">Outlined</smart-button> <smart-button class="flat success">Flat</smart-button> <smart-button class="floating success"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" > <i class="material-icons"></i> </span> </smart-button> </div> </div> <div> <label>Error Buttons</label> <div class="demo-buttons-group"> <smart-button class="error">Normal</smart-button> <smart-button class="raised error">Raised</smart-button> <smart-button class="outlined error">Outlined</smart-button> <smart-button class="flat error">Flat</smart-button> <smart-button class="floating error"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" > <i class="material-icons"></i> </span> </smart-button> </div> </div> </div> </div></template><script>import { onMounted } from "vue";import "smart-webcomponents/source/styles/smart.default.css";import "smart-webcomponents/source/modules/smart.button.js";export default { name: "app", setup() { onMounted(() => {}); }};</script><style>.demo-horizontal-layout { display: flex; flex-direction: column;}.dark-mode .demo-icon { background-image: none;}label { font-size: 14px;}.demo-buttons-group { margin: 8px;}.demo-buttons-group smart-ui-button { margin: 8px;}.button-demo-icon { position: relative; left: -5px;}</style>We can now use thesmart-button with Vue 3. Data binding and event handlers will just work right out of the box.
Make Vue ignore custom elements defined outside of Vue (e.g., using the Web Components APIs). Otherwise, it will throw a warning about an Unknown custom element, assuming that you forgot to register a global component or misspelled a component name.
Open src/main.js in your favorite text editor and change its contents to the following:import Vue from 'vue'import App from './App.vue'Vue.config.productionTip = falseVue.config.ignoredElements = ['smart-button']new Vue({ render: h => h(App),}).$mount('#app')
<template> <div class="demo-horizontal-layout"> <div> <label>Default Buttons</label> <div class="demo-buttons-group"> <smart-button>Normal</smart-button> <smart-button class="raised">Raised</smart-button> <smart-button class="outlined">Outlined</smart-button> <smart-button class="flat">Flat</smart-button> <smart-button class="floating"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" ></span> </smart-button> </div> </div> <div> <label>Primary Buttons</label> <div class="demo-buttons-group"> <smart-button class="primary">Normal</smart-button> <smart-button class="raised primary">Raised</smart-button> <smart-button class="outlined primary">Outlined</smart-button> <smart-button class="flat primary">Flat</smart-button> <smart-button class="floating primary"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" ></span> </smart-button> </div> </div> <div> <label>Secondary Buttons</label> <div class="demo-buttons-group"> <smart-button class="secondary">Normal</smart-button> <smart-button class="raised secondary">Raised</smart-button> <smart-button class="outlined secondary">Outlined</smart-button> <smart-button class="flat secondary">Flat</smart-button> <smart-button class="floating secondary"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" ></span> </smart-button> </div> </div> <div> <label>Success Buttons</label> <div class="demo-buttons-group"> <smart-button class="success">Normal</smart-button> <smart-button class="raised success">Raised</smart-button> <smart-button class="outlined success">Outlined</smart-button> <smart-button class="flat success">Flat</smart-button> <smart-button class="floating success"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" ></span> </smart-button> </div> </div> <div> <label>Error Buttons</label> <div class="demo-buttons-group"> <smart-button class="error">Normal</smart-button> <smart-button class="raised error">Raised</smart-button> <smart-button class="outlined error">Outlined</smart-button> <smart-button class="flat error">Flat</smart-button> <smart-button class="floating error"> <span class="button-demo-icon demo-icon demo-device-icon-phone-portrait demo-button-demo-icon" ></span> </smart-button> </div> </div> </div></template> <script>import 'smart-webcomponents/source/modules/smart.button.js';import "smart-webcomponents/source/styles/smart.default.css";export default { name: "app"};</script><style>.demo-horizontal-layout { display: flex; flex-direction: column;}.dark-mode .demo-icon { background-image: none;}label { font-size: 14px;}.demo-buttons-group { margin: 8px;}.demo-buttons-group smart-button { margin: 8px;}.button-demo-icon { position: relative; left: -5px;}</style>We can now use thesmart-button with Vue. Data binding and event handlers will just work right out of the box.
npm run devandopen localhost:8080 in your favorite web browser to see the output below:
Read more about using Smart UI for Vue:https://www.htmlelements.com/docs/vue/.
Smart.Button follows HTML button's keyboard navigation behavior. This means that the button can be selected usingSpace. The element is focusable and can be focused using theTab button.