Skip to content

Button

Overview

Extrude Button is a highly customizable 3D button component that brings depth and interactivity to your user interface. It supports various animations, materials, and styling options.

Usage

import { ExtrudeButton } from 'extrude-ui';
function MyComponent() {
return (
<ExtrudeButton
text="Click Me!"
size="medium"
color="#4CAF50"
depth={1.5}
hover={true}
/>
);
}

Examples:

Shiny Rounded Button

Pill Button

Gradient Button

Props

Core Props

PropTypeDefaultDescription
textstringThe text content of the button
onClick() => voidFunction called when button is clicked
disabledbooleanfalseWhether the button is disabled

Styling Props

PropTypeDefaultDescription
colorstring"#ffffff"Primary color of the button
size'small' | 'medium' | 'large' | 'xlarge'"medium"Size of the button
shape'rounded' | 'square' | 'pill'"rounded"Shape of the button
fontstringCustom font family
textColorstring"#000000"Color of the button text
opacitynumber1Overall opacity of the button

3D Properties

PropTypeDefaultDescription
depthnumber1Depth of the button

Material Properties

PropTypeDefaultDescription
metalnessnumber0Metallic material effect
roughnessnumber0.5Surface roughness

Animation Properties

PropTypeDefaultDescription
animation'spin' | 'flip' | 'rock' | 'none'"spin"onClick animation

Shadow Properties

PropTypeDefaultDescription
shadowColorstring"#000000"Color of the shadow
shadowOpacitynumber0.2Opacity of the shadow (0-1)

Gradient Properties

PropTypeDescription
gradient{ from: string; to: string; angle?: number }Configure a gradient background

Loading State

PropTypeDefaultDescription
fallbackReact.ReactNodeOverrides the default loading animation.
loadingAnimation'spinner' | 'pulse' | 'dots' | 'none'"spinner"Type of loading animation
loadingColorstringColor of the loading indicator

Code From Examples:

Shiny Rounded Button

<ExtrudeButton
text="Click Me!"
size="medium"
color="#4CAF50"
depth={3}
animation="flip"
metalness={1}
roughness={.1}
/>

Pill Button

<ExtrudeButton
text="Click Me!"
shape="pill"
animation="spin"
depth={5}
opacity={0.5}
/>

Gradient Button

<ExtrudeButton
text="Gradient"
animation="rock"
gradient={{
from: "#7f2dfd",
to: "#f203ff",
angle: 18
}}
/>