Buttons
Gradient Border Button
The gradient lives in the border rather than the fill: two backgrounds across padding-box and border-box, plus a focus ring that gradients usually swallow.
- button
- gradient
- border
- focus
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/button-041?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "button-041" (Gradient Border Button) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/button-041.json
Registry item: https://vibeui.ru/r/button-041.json
Installs to: components/vibeui/button-041.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
The gradient lives in the border rather than the fill: two backgrounds across padding-box and border-box, plus a focus ring that gradients usually swallow.
A button with a gradient border and a paper middle. The border stays a real border: it is the second background painted across border-box, so radius and width behave normally. Focus is handled separately — an offset ring plus a white halo so it stays visible over the gradient. Zero dependencies, one file.
## 3. How to use it
import { Button041 } from "@/components/vibeui/button-041"
<Button041 onClick={build}>Build the page</Button041>
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the padding-box and border-box background pair: it is the only way to get a gradient border without an extra node
- border:2px solid transparent — with no transparent border there is nowhere to paint the second background
- the offset focus ring plus the box-shadow halo: a plain outline gets lost against a gradient
- the gradient built from the accent and accentEnd variables rather than hardcoded colours
- the same gradient inside the spark mark — it ties the content to the border
- the paper middle: dark text on it reads against any backdrop
## 6. You may change
- the label
- the first gradient colour through the accent prop
- the second gradient colour through the accentEnd prop
- the onClick handler and the rest of the native button props
- the gradient angle and the radius — both live in one place in the style block
## 7. Rules
- Do not replace the background pair with a wrapper and an inner div: the extra node breaks native prop forwarding to the button.
- Do not remove the box-shadow halo on focus — against a light gradient the ring merges with the border.
- Do not fill the middle with the gradient: that turns it into an ordinary gradient button, not a gradient border.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/button-041.jsonhttps://vibeui.ru/r/button-041.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-button-041-*. Серверный компонент. Приём: border:2px solid transparent и два фона — сплошной по padding-box для середины и линейный градиент по border-box для границы. Из-за прозрачной рамки системная обводка фокуса теряется на градиенте, поэтому focus-visible даёт outline с отступом 3px плюс белое кольцо box-shadow, отделяющее обводку от границы.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Button041Props = ComponentPropsWithoutRef<"button"> & {
accent?: string
/** Второй цвет градиента: рамка собирается из пары. */
accentEnd?: string
}
// Идея компонента: градиент живёт в рамке, а не в заливке. Он собран из двух
// фонов — padding-box для бумажной середины и border-box для градиентной
// границы, — поэтому граница остаётся настоящим border. Главное здесь фокус:
// градиент на границе съедает системную обводку, и focus-visible рисуется
// отдельным box-shadow-кольцом плюс outline с отступом.
const STYLES = `
:where([data-vibeui-block="button-041"]){
--vibeui-button-041-paper:oklch(1 0 0);
--vibeui-button-041-accent:oklch(0.6 0.2 25);
--vibeui-button-041-accent-end:oklch(0.55 0.2 300);
--vibeui-button-041-ink:oklch(0.26 0.02 285);
--vibeui-button-041-radius:0.75rem;
--vibeui-button-041-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="button-041"]{
appearance:none;cursor:pointer;box-sizing:border-box;
display:inline-flex;align-items:center;gap:0.5rem;
height:2.75rem;padding:0 1.125rem;
border:2px solid transparent;border-radius:var(--vibeui-button-041-radius);
/* Два фона: середина по padding-box, градиент по border-box. */
background:
linear-gradient(var(--vibeui-button-041-paper),var(--vibeui-button-041-paper)) padding-box,
linear-gradient(110deg,var(--vibeui-button-041-accent),var(--vibeui-button-041-accent-end)) border-box;
color:var(--vibeui-button-041-ink);
font-family:var(--vibeui-button-041-font);font-size:0.875rem;font-weight:650;line-height:1;
transition:box-shadow .18s ease,color .16s ease;
}
[data-vibeui-block="button-041"]:hover:not(:disabled){
box-shadow:0 10px 24px -16px color-mix(in oklab,var(--vibeui-button-041-accent-end) 90%,transparent);
color:var(--vibeui-button-041-accent-end);
}
/* Кольцо фокуса дублируется box-shadow: outline поверх градиентной границы
в некоторых движках читается хуже, а кольцо всегда лежит по её форме. */
[data-vibeui-block="button-041"]:focus-visible{
outline:2px solid var(--vibeui-button-041-accent-end);outline-offset:3px;
box-shadow:0 0 0 1px var(--vibeui-button-041-paper);
}
[data-vibeui-block="button-041"]:disabled{cursor:not-allowed;opacity:.5}
[data-vibeui-block="button-041"] [data-part="spark"]{
flex:none;width:0.75rem;height:0.75rem;
background:linear-gradient(110deg,var(--vibeui-button-041-accent),var(--vibeui-button-041-accent-end));
clip-path:polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="button-041"]{transition:none!important}}
`
/**
* Кнопка с градиентной рамкой и не сломанным фокусом.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Button041({
accent,
accentEnd,
type = "button",
className,
style,
children = "Собрать страницу",
...props
}: Button041Props) {
const palette = {
...(accent ? { "--vibeui-button-041-accent": accent } : null),
...(accentEnd ? { "--vibeui-button-041-accent-end": accentEnd } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-button-041" precedence="medium">
{STYLES}
</style>
<button
{...props}
type={type}
data-vibeui-block="button-041"
className={className}
style={palette}
>
<span data-part="spark" aria-hidden="true" />
{children}
</button>
</>
)
}