1.0.0 • Published 4 years ago

@jsdesign/jsd-jsd-button v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

<jsd-button>

Simple button web-component to be use accross web irrespective of frameworks

Installation

npm install @jsdesign/jsd-button

Attributes

NameTypeDefaultDescription
labelstring''Label to display for the button, and aria-label.
btn-stylestring'primary'Set the button style. Allowed values: 'primary', 'secondary', 'tertiary'.
disabledstring'false'Disabled buttons cannot be interacted with and have no visual interaction effect. Allowed values: 'true', 'false'.
iconstring'false'When 'true', icon will be displayed before label.
trailing-iconstring'false'When 'true', icon will be displayed after label.
themestringlightThe button will adapt to dark theme. Allowed values: 'dark', 'light'.
typestring'button'Set the button type. Allowed values: 'button', 'submit', 'reset'.
full-widthstring'false'Makes the button take full available space. Allowed values: 'true', 'false'.

Examples

Primary Button

npm.io npm.io

<jsd-button label='Testing'></jsd-button>
<jsd-button btn-style='primary' label='Testing'></jsd-button>

Secondary Button

npm.io npm.io

<jsd-button btn-style='secondary' label='Secondary'></jsd-button>

Tertiary Button

npm.io npm.io

<jsd-button tertiary label='Tertiary'></jsd-button>

Icon Button

npm.io npm.io

<jsd-button icon='true' label='Icon Button'>
    <span slot='icon'>&hearts;</span>
</jsd-button>

<jsd-button trailing-icon='true' label='Icon Button'>
    <span slot='trailingIcon'>&hearts;</span>
</jsd-button>

We can pass any custom icon html in the slot elements. Also u are allowed to create css icons and can style it your way.

Cutomization

npm.io

<jsd-button id="custom-button" btn-style='primary' theme='dark' label='CUSTOM BUTTON'>
</jsd-button>
#custom-button {
    --color-primary: #e9437a;
    --border-radius: 30px;
}

Cutomizable property list

NameDefault
--color-btn-style='primary'#1eba68;
--color-primary-dark#1ba75e;
--color-btn-style='secondary'#f6f6f6;
--color-secondary-dark#efefef;
--color-secondary-darkthemergba(255, 255, 255, 0.3);
--color-secondary-dark-darkthemergba(255, 255, 255, 0.6);
--color-error#dd4421;
--color-error-background#ffebe6;
--color-placeholder#737373;
--color-placeholder-disabled#e0e0e0;
--color-placeholder-darktheme#e0e0e0;
--color-label#909090;
--color-black#2c2c2c;
--color-header-black#252525;
--color-header-tag#747373;
--color-white#ffffff;
--color-border#edebeb;
--border-radius0.5rem;
--border-width1px;
--border-width-hover3px;
--label-spacing0.2rem;
--label-caseuppercase;
--label-font-size0.8rem;
--button-font-weight500;
1.0.0

4 years ago