UNPKG

@ionic/core

Version:

Base components for Ionic

100 lines (99 loc) • 2.84 kB
import { Component, Host, Prop, h } from '@stencil/core'; import { getIonMode } from '../../global/ionic-global'; import { createColorClasses } from '../../utils/theme'; /** * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. */ export class Chip { constructor() { /** * Display an outline style button. */ this.outline = false; /** * If `true`, the user cannot interact with the chip. */ this.disabled = false; } render() { const mode = getIonMode(this); return (h(Host, { "aria-disabled": this.disabled ? 'true' : null, class: createColorClasses(this.color, { [mode]: true, 'chip-outline': this.outline, 'chip-disabled': this.disabled, 'ion-activatable': true, }) }, h("slot", null), mode === 'md' && h("ion-ripple-effect", null))); } static get is() { return "ion-chip"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "ios": ["chip.ios.scss"], "md": ["chip.md.scss"] }; } static get styleUrls() { return { "ios": ["chip.ios.css"], "md": ["chip.md.css"] }; } static get properties() { return { "color": { "type": "string", "mutable": false, "complexType": { "original": "Color", "resolved": "string | undefined", "references": { "Color": { "location": "import", "path": "../../interface" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "The color to use from your application's color palette.\nDefault options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\nFor more information on colors, see [theming](/docs/theming/basics)." }, "attribute": "color", "reflect": true }, "outline": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "Display an outline style button." }, "attribute": "outline", "reflect": false, "defaultValue": "false" }, "disabled": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "If `true`, the user cannot interact with the chip." }, "attribute": "disabled", "reflect": false, "defaultValue": "false" } }; } }