opensourceui
GitHubTwitter/X
  1. Home
  2. Components
  3. Buttons
  4. Depth Outline Button
Back to Buttons

Components / Buttons

Depth Outline Button

Free Buttons React component — DepthOutlineButton. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.

Premium outline button with layered float depth, a soft top lip, and a press-in sink — secondary CTA that still feels tactile. Pass any children.

Preview

Setup

How to use

Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/buttons/depth-outline-button.tsx in your project.

  4. 4

    Import and render:

    Example

    import { DepthOutlineButton } from "@/components/buttons/depth-outline-button";

    <DepthOutlineButton>Learn more</DepthOutlineButton>

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/buttons/depth-outline-button.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"use client";
 
import {
forwardRef,
type ComponentPropsWithoutRef,
type ReactNode,
} from "react";
 
import { cn } from "@/lib/cn";
 
export type DepthOutlineButtonSize = "sm" | "md" | "lg";
 
export type DepthOutlineButtonProps = Readonly<
{
children: ReactNode;
size?: DepthOutlineButtonSize;
} & ComponentPropsWithoutRef<"button">
>;
 
const SIZE: Record<DepthOutlineButtonSize, string> = {
sm: "h-9 gap-1.5 rounded-lg px-3.5 text-xs tracking-wide",
md: "h-10 gap-2 rounded-xl px-4 text-sm tracking-wide",
lg: "h-12 gap-2 rounded-xl px-5 text-sm tracking-wide",
};
 
// Resting: dual-edge (hairline + float) with a soft top lip — not a flat border.
const REST =
"shadow-[0_0_0_1px_rgba(0,0,0,0.06),0_1px_1px_rgba(0,0,0,0.04),0_4px_10px_rgba(0,0,0,0.05),0_12px_28px_rgba(0,0,0,0.05),inset_0_1px_1px_rgba(255,255,255,0.75),inset_0_-1px_2px_rgba(0,0,0,0.04)]";
 
const HOVER =
"hover:bg-neutral-50 hover:text-neutral-950 hover:shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_2px_4px_rgba(0,0,0,0.05),0_8px_16px_rgba(0,0,0,0.07),0_20px_40px_rgba(0,0,0,0.06),inset_0_1px_1px_rgba(255,255,255,0.8),inset_0_-1px_2px_rgba(0,0,0,0.05)]";
 
const PRESSED =
"active:bg-neutral-100 active:shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_1px_2px_rgba(0,0,0,0.04),inset_0_2px_4px_rgba(0,0,0,0.08),inset_0_1px_0_rgba(255,255,255,0.6)]";
 
// DepthOutlineButton — premium outlined CTA with layered float depth; pass any children.
export const DepthOutlineButton = forwardRef<
HTMLButtonElement,
DepthOutlineButtonProps
>(
(
{
className,
children,
size = "md",
type = "button",
disabled,
...props
},
ref,
) => {
return (
<button
ref={ref}
type={type}
disabled={disabled}
data-slot="depth-outline-button"
data-size={size}
className={cn(
"inline-flex cursor-pointer items-center justify-center bg-white font-sans font-semibold text-neutral-800 outline-none select-none",
"transition-[background-color,box-shadow,color,transform] duration-200 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none",
"active:translate-y-px motion-reduce:active:translate-y-0",
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-900",
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-40",
REST,
HOVER,
PRESSED,
SIZE[size],
className,
)}
{...props}
>
{children}
</button>
);
},
);
 
DepthOutlineButton.displayName = "DepthOutlineButton";
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/buttons/depth-outline-button.tsx

Sponsor spot · demo preview

Logo

Your brand name

Your tagline or category

A short pitch about your product or service goes here. This is a preview of how sponsor cards will look in this sidebar.

Your call to action

This slot is available. Sponsor Opensource UI and reach developers browsing components every day.