Skip to content

Raised button in React

A chunky button that sinks under the finger, for primary actions.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

RaisedButton.tsx
import type { ButtonHTMLAttributes } from "react";

type Variant = "primary" | "secondary";
type Size = "small" | "medium" | "large";

const variants: Record<Variant, string> = {
  primary:
    "border-indigo-900 bg-indigo-600 text-white [--edge:var(--color-indigo-900)] dark:border-indigo-400 dark:bg-indigo-400 dark:text-indigo-950 dark:[--edge:var(--color-indigo-700)]",
  secondary:
    "border-indigo-900 bg-white text-indigo-900 [--edge:var(--color-indigo-900)] dark:border-indigo-500 dark:bg-indigo-950 dark:text-indigo-100 dark:[--edge:var(--color-indigo-500)]",
};
RaisedButtonDemo.tsx
import { RaisedButton } from "./RaisedButton";

export function RaisedButtonDemo() {
  return (
    <div className="flex flex-wrap items-center justify-center gap-5 p-8">
      <RaisedButton size="small">Ajouter</RaisedButton>
      <RaisedButton>Réserver une table</RaisedButton>
      <RaisedButton variant="secondary">Voir la carte</RaisedButton>
      <RaisedButton size="large">Demander un devis</RaisedButton>
    </div>
  );
}

Free component: copy it freely, including for commercial projects.

Buttons components in React
  • A row of buttons to share the page on Facebook, LinkedIn, WhatsApp or by email, with a copy-link button and no third-party script.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Toggle heart buttons that count favourites, remember them between visits and announce them to screen readers.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A button that adds an event to Google Calendar, Outlook or any calendar through an .ics file, with no third-party service.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A button that copies an IBAN, a reference, an address or a promo code and confirms "Copied", on screen and to screen readers.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A WhatsApp button pinned to the bottom of the screen that opens a welcome bubble with common topics and a pre-filled message, with no third-party widget.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A bar pinned to the bottom of mobile screens with Call and Directions buttons and a live open-now status, built for trades and local shops.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component