lara-light-indigo

Button

Button is an extension to standard input element with icons and theming.

Basic
Icons
Loading
Severities
Raised Buttons
Rounded Buttons
Text Buttons
Raised Text Buttons
Outlined Buttons
Rounded Icon Buttons
Rounded Text Icon Buttons
Rounded and Outlined Icon Buttons
Badges
Button Set
Sizes
Template
Import via Module

import { Button } from 'primereact/button';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
 
Getting Started

Button is created using the Button element.


<Button />
 
Label

Text of the button is defined using the label property.


<Button label="Save" />
 
Icons

Icon on a button is specified with icon property and position is configured using iconPos attribute. Default icon position is "left" and alternative is "right". To display only an icon, leave label as undefined.


<Button label="Click" icon="pi pi-check" />
<Button label="Click" icon="pi pi-check" iconPos="right" />
<Button icon="pi pi-check" iconPos="right" />
 
Loading

Loading on a button is specified with loading attribute and loading icon can be change with loadingIcon property. To display only a loading, leave label as undefined.


<Button loading />
<Button label="Submit" loading />
<Button label="Submit" loading loadingIcon="pi pi-spin pi-sun" />
 
Events

Events are defined with the standard notation.


<Button label="Click" onClick={handleClick} />
 
Severity

Different color options are available as severity levels.

  • .p-button-secondary
  • .p-button-success
  • .p-button-info
  • .p-button-warning
  • .p-button-danger

<Button label="Primary" />
<Button label="Secondary" className="p-button-secondary" />
<Button label="Success" className="p-button-success" />
<Button label="Info" className="p-button-info" />
<Button label="Warning" className="p-button-warning" />
<Button label="Danger" className="p-button-danger" />
 
Raised and Rounded Buttons

A button can be raised by having "p-button-raised" style class and similarly borders can be made rounded using "p-button-rounded" class.


<Button label="Proceed" className="p-button-raised p-button-rounded" />
 
Properties
NameTypeDefaultDescription
labelstringnullText of the button.
iconanynullName of the icon or JSX.Element for icon.
iconPosstringleftPosition of the icon, valid values are "left", "right", "top" and "bottom".
badgestringnullValue of the badge.
badgeClassNamestringnullStyle class of the badge.
tooltipanynullContent of the tooltip.
tooltipOptionsobjectnullConfiguration of the tooltip, refer to the tooltip documentation for more information.
loadingbooleanfalseDisplay loading icon of the button
loadingIconanynullName of the loading icon or JSX.Element for loading icon.
Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-buttonButton element
p-button-iconIcon element
p-button-textLabel element of the button
Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma