Tailwind CSS Button - React

Use our buttons based on Tailwind CSS for actions in forms, dialogues, and more.

Buttons are an essential element of web design. Basically, buttons are styled links that grab the users’ attention. They help users navigate our websites or apps and drive them to a particular action like submitting a contact form or placing an order as easy as possible.

See below our button example that you can use in your Tailwind CSS and React project. The example also comes in different styles and colors, so you can adapt it easily to your needs.


import { Button } from "@material-tailwind/react";
 
export default function Example() {
  return <Button>Button</Button>;
}

Button Variants

The button component comes with 4 different variants that you can change it using the variant prop.

import { Button } from "@material-tailwind/react";
 
export default function Variants() {
  return (
    <div className="flex gap-4 w-max">
      <Button variant="filled">filled</Button>
      <Button variant="gradient">gradient</Button>
      <Button variant="outlined">outlined</Button>
      <Button variant="text">text</Button>
    </div>
  );
}

Button Sizes

The button component comes with 3 different sizes that you can change it using the size prop.

import { Button } from "@material-tailwind/react";
 
export default function Sizes() {
  return (
    <div className="flex items-end gap-4 w-max">
      <Button size="sm">small</Button>
      <Button size="md">medium</Button>
      <Button size="lg">large</Button>
    </div>
  );
}

Button Colors

The button component comes with 19 different colors that you can change it using the color prop, below there are some examples of the colors but you can check all of the them here.

import { Button } from "@material-tailwind/react";
 
export default function Colors() {
  return (
    <div className="flex gap-4 w-max">
      <Button color="blue">color blue</Button>
      <Button color="red">color red</Button>
      <Button color="green">color green</Button>
      <Button color="amber">color amber</Button>
    </div>
  );
}

Props

The following props are available for the button component. These are the custom props that come with we've added for the button component and you can use all the other native button props as well.

AttributeTypeDescriptionDefault
variantVariantChange button variantfilled
sizeSizeChange button sizemd
colorColorChange button colorblue
fullWidthbooleanChange button to a block level elementfalse
ripplebooleanAdd ripple effect for buttontrue
classNamestringAdd custom className for button''
childrennodeAdd content for buttonNo default value its a required prop.

Types

type variant = "filled" | "outlined" | "gradient" | "text";
type size = "sm" | "md" | "lg";
type color =
  | "blue-grey"
  | "grey"
  | "brown"
  | "deep-orange"
  | "orange"
  | "amber"
  | "yellow"
  | "lime"
  | "light-green"
  | "green"
  | "teal"
  | "cyan"
  | "light-blue"
  | "blue"
  | "indigo"
  | "deep-purple"
  | "purple"
  | "pink"
  | "red";