🔥 Meet Our New Project: t0ggles - Your Ultimate Project Management Tool! 🔥

Button React Component

Button Components

There are following components included:

  • Button - single button

Button Props

NameTypeDefaultDescription
clearbooleanundefined

Makes button in clear style (without fill color). Overwrites clearIos and clearMaterial props

clearIosbooleanfalse

Makes button in clear style (without fill color) in iOS theme

clearMaterialbooleanfalse

Makes button in clear style (without fill color) in Material theme

colorsobject

Object with Tailwind CSS colors classes

colors.activeBgIosstring'active:bg-primary'
colors.activeBgMaterialstring''
colors.disabledBgstring'bg-black bg-opacity-10 dark:bg-white dark:bg-opacity-10'
colors.disabledBorderstring'border-black border-opacity-10 dark:border-white dark:border-opacity-10'
colors.disabledTextstring'text-black text-opacity-30 dark:text-white dark:text-opacity-30'
colors.fillActiveBgIosstring'active:bg-ios-primary-shade'
colors.fillActiveBgMaterialstring''
colors.fillBgIosstring'bg-primary'
colors.fillBgMaterialstring'bg-md-light-primary dark:bg-md-dark-primary'
colors.fillTextIosstring'text-white'
colors.fillTextMaterialstring'text-md-light-on-primary dark:text-md-dark-on-primary'
colors.fillTouchRipplestring'touch-ripple-white dark:touch-ripple-primary'
colors.outlineBorderIosstring'border-primary'
colors.outlineBorderMaterialstring'border-md-light-outline dark:border-md-dark-outline'
colors.textIosstring'text-primary'
colors.textMaterialstring'text-md-light-primary dark:text-md-dark-primary'
colors.tonalBgIosstring'bg-primary'
colors.tonalBgMaterialstring'bg-md-light-secondary-container dark:bg-md-dark-secondary-container'
colors.tonalTextIosstring'text-primary'
colors.tonalTextMaterialstring'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container'
colors.touchRipplestring'touch-ripple-primary'
componentstring'button'

Component's HTML Element

disabledbooleanfalse

Makes button disabled

hrefstring

Link's href attribute, when specified will also be rendered as <a> element

inlinebooleanfalse

Makes button inline (e.g. display: inline-flex)

largebooleanundefined

Makes button large. Overwrites largeIos and largeMaterial props

largeIosbooleanfalse

Makes button large in iOS theme

largeMaterialbooleanfalse

Makes button large in Material theme

outlinebooleanundefined

Makes button outline. Overwrites outlineIos and outlineMaterial props

outlineIosbooleanfalse

Makes button outline in iOS theme

outlineMaterialbooleanfalse

Makes button outline in Material theme

raisedbooleanundefined

Makes button raised (with shadow). Overwrites raisedIos and raisedMaterial props

raisedIosbooleanfalse

Makes button raised (with shadow) in iOS theme

raisedMaterialbooleanfalse

Makes button raised (with shadow) in Material theme

roundedbooleanundefined

Makes button rounded. Overwrites roundedIos and roundedMaterial props

roundedIosbooleanfalse

Makes button rounded in iOS theme

roundedMaterialbooleanfalse

Makes button rounded in Material theme

segmentedbooleanfalse

Renders segmented button, same as <SegmentedButton>

segmentedActivebooleanfalse

Renders segmented active button, same as <SegmentedButton active>

segmentedStrongbooleanfalse

Renders segmented strong button, same as <SegmentedButton strong>

smallbooleanundefined

Makes button small. Overwrites smallIos and smallMaterial props

smallIosbooleanfalse

Makes button small in iOS theme

smallMaterialbooleanfalse

Makes button small in Material theme

tonalbooleanundefined

Makes button in tonal style (with semitransparent fill color). Overwrites tonalIos and tonalMaterial props

tonalIosbooleanfalse

Makes button in tonal style (with semitransparent fill color) in iOS theme

tonalMaterialbooleanfalse

Makes button in tonal style (with semitransparent fill color) in Material theme

touchRipplebooleantrue

Enables touch ripple effect in Material theme

Examples

Buttons.jsx
import React from 'react';
import {
Page,
Navbar,
NavbarBackLink,
Button,
Block,
BlockTitle,
} from 'konsta/react';
export default function ButtonsPage() {
return (
<Page>
<Navbar
title="Buttons"
/>
<BlockTitle>Default Buttons</BlockTitle>
<Block strong outlineIos className="space-y-2">
<div className="grid grid-cols-3 gap-x-4">
<Button>Button</Button>
<Button className="k-color-brand-red">Button</Button>
<Button>Button</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button outline>Outline</Button>
<Button className="k-color-brand-red" outline>
Outline
</Button>
<Button outline>Outline</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button clear>Clear</Button>
<Button className="k-color-brand-red" clear>
Clear
</Button>
<Button clear>Clear</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button tonal>Tonal</Button>
<Button className="k-color-brand-red" tonal>
Tonal
</Button>
<Button tonal>Tonal</Button>
</div>
</Block>
<BlockTitle>Rounded Buttons</BlockTitle>
<Block strong outlineIos className="space-y-2">
<div className="grid grid-cols-3 gap-x-4">
<Button rounded>Button</Button>
<Button rounded className="k-color-brand-green">
Button
</Button>
<Button rounded>Button</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button rounded outline>
Outline
</Button>
<Button rounded outline className="k-color-brand-green">
Outline
</Button>
<Button rounded outline>
Outline
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button rounded clear>
Clear
</Button>
<Button rounded clear className="k-color-brand-green">
Clear
</Button>
<Button rounded clear>
Clear
</Button>
</div>
</Block>
<BlockTitle>Large Buttons</BlockTitle>
<Block strong outlineIos className="space-y-2">
<div className="grid grid-cols-3 gap-x-4">
<Button large>Button</Button>
<Button large className="k-color-brand-yellow">
Button
</Button>
<Button large rounded>
Button
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button large outline>
Outline
</Button>
<Button large outline className="k-color-brand-yellow">
Outline
</Button>
<Button large rounded outline>
Outline
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button large clear>
Clear
</Button>
<Button large clear className="k-color-brand-yellow">
Clear
</Button>
<Button large rounded clear>
Clear
</Button>
</div>
</Block>
<BlockTitle>Small Buttons</BlockTitle>
<Block strong outlineIos className="space-y-2">
<div className="grid grid-cols-3 gap-x-4">
<Button small>Button</Button>
<Button small>Button</Button>
<Button small rounded>
Button
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button small outline>
Outline
</Button>
<Button small outline>
Outline
</Button>
<Button small rounded outline>
Outline
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button small clear>
Clear
</Button>
<Button small clear>
Clear
</Button>
<Button small rounded clear>
Clear
</Button>
</div>
</Block>
<BlockTitle>Raised Buttons</BlockTitle>
<Block strong outlineIos className="space-y-2">
<div className="grid grid-cols-3 gap-x-4">
<Button raised>Button</Button>
<Button raised>Button</Button>
<Button raised rounded>
Button
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button raised outline>
Outline
</Button>
<Button raised outline>
Outline
</Button>
<Button raised rounded outline>
Outline
</Button>
</div>
<div className="grid grid-cols-3 gap-x-4">
<Button raised clear>
Clear
</Button>
<Button raised clear>
Clear
</Button>
<Button raised rounded clear>
Clear
</Button>
</div>
</Block>
<BlockTitle>Disabled Buttons</BlockTitle>
<Block strong outlineIos className="space-y-2">
<div className="grid grid-cols-3 gap-x-4">
<Button disabled>Button</Button>
<Button disabled outline>
Outline
</Button>
<Button disabled clear>
Clear
</Button>
</div>
</Block>
</Page>
);
}
Code licensed under MIT.
2022 © Konsta UI by nolimits4web.