Cosmic Button
CosmicButton is a client-side animated CTA component that renders an anchor by default and can render a native button with `as="button"`. It combines a rotating lime cosmic gradient border, texture overlay, theme-aware inner surface, hover expansion, and keyboard focus styling.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @cult-ui in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { CosmicButton } from "@/components/ui/cosmic-button"<> <CosmicButton href="/about">About us</CosmicButton> <CosmicButton href="/pricing">View pricing</CosmicButton> <CosmicButton as="button" type="button" onClick={() => alert("Submitted")}>Submit</CosmicButton> <CosmicButton as="button" type="button" disabled>Unavailable</CosmicButton></>- Use as a prominent link or CTA where a distinctive animated border is appropriate.
- Use `as="button"` for actions such as submitting, opening dialogs, or triggering client-side behavior.
- Use for marketing, landing-page, onboarding, or futuristic interface designs that benefit from a vibrant cosmic accent.
- Avoid using it for every control on a page, because the animated treatment is visually emphatic.
Examples
Default external or internal link
The default element is an anchor. The component supplies a fallback URL, rel, and target when those values are omitted, so provide an explicit `href` for normal application navigation.
import { CosmicButton } from "@/components/ui/cosmic-button"<CosmicButton href="/dashboard">Open dashboard</CosmicButton>Button action
Set `as="button"` to receive native button behavior and button-specific props such as `type`, `disabled`, and `onClick`.
import { CosmicButton } from "@/components/ui/cosmic-button"<CosmicButton as="button" type="button" onClick={() => console.log("Launching")}> Launch experience</CosmicButton>Custom link behavior
Anchor attributes are passed through, including `target`, `rel`, `aria-label`, and custom classes merged with the component styles.
import { CosmicButton } from "@/components/ui/cosmic-button"<CosmicButton href="https://example.com/docs" target="_blank" rel="noopener noreferrer" aria-label="Read the documentation" className="uppercase"> Read docs</CosmicButton>Icon or rich content
Children are rendered inside the styled content area and can contain inline elements such as an icon and text.
import { CosmicButton } from "@/components/ui/cosmic-button"<CosmicButton href="/get-started"> <span aria-hidden="true">✦</span> Get started</CosmicButton>API reference
Accessibility
- The default anchor and the `as="button"` variant use native semantic HTML elements and their associated keyboard behavior.
- A visible lime `:focus-visible` ring is provided with a two-pixel width and theme-aware offset.
- Provide meaningful children or an accessible label; the default `Placeholder text` is intended only as a fallback.
- Use `type="button"` when the button is inside a form and should not submit it.
- The component requires the `animate-cosmic-spin` and `animate-cosmic-spin-slow` CSS utilities and their corresponding keyframes; consider adding a reduced-motion strategy in the surrounding application if animated borders are unsuitable.
Docs written by openai:gpt-5.6-luna from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Cosmic Button" component (cult-ui/cosmic-button) from its shadcn registry.1. Install it with: npx shadcn@latest add @cult-ui/cosmic-button2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: as, className, children, anchor props, button props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { CosmicButton } from "@/components/ui/cosmic-button"<> <CosmicButton href="/about">About us</CosmicButton> <CosmicButton href="/pricing">View pricing</CosmicButton> <CosmicButton as="button" type="button" onClick={() => alert("Submitted")}>Submit</CosmicButton> <CosmicButton as="button" type="button" disabled>Unavailable</CosmicButton></>```Files & dependencies
- registry/default/ui/cosmic-button.tsx