Button Link

A component to render a link as a button. This component is a wrapper around the NuxtLink component.

Color

You can use any color from your Pinceau design system tokens configuration file as a value of color prop. The convention used is a color palette named from 50 to 900.

MDC
:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="gray"}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="red"}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="blue"}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="green"}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="yellow"}

Ghost button

It is possible to make a button transparent by using the ghost prop. Useful for secondary links.

MDC
:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank ghost}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="gray" ghost}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="red" ghost}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="blue" ghost}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="green" ghost}

:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank color="yellow" ghost}

Sizes

The button comes in 4 sizes: small, medium, large and giant.

MDC
:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank size="small"}
:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank}
:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank size="large"}
:button-link[Play on StackBlitz]{icon="IconStackBlitz" href="https://stackblitz.com/github/nyxb/docux-starter" blank size="giant"}

Props

PropsTypeDefaultDescription
hrefString''The URL to link to. The prop is required
blankBooleanfalseWhether to open the link in a new tab
iconString''The icon to display (only on left side currently). Any component name prefixed with Icon, icon name from Iconify or any emoji could be used.
colorStringprimaryThe color of the button. The color should be a valid key from the Pinceau color tokens configuration.
ghostBooleanfalseWhether to make the button transparent.

Slots

SlotDescription
defaultThe content of the button.

Design Tokens

tokens.config.ts
import { defineTheme } from 'pinceau'

export default defineTheme({
   elements: {
      buttonLink: {
         fontWeight: '{fontWeight.semibold}',
         borderWidth: '0px',
         borderStyle: 'solid',
         borderColor: 'transparent',
         borderRadius: '{radii.2xs}',
         boxShadow: 'inset 0.25px 0.5px 0px hsla(0,0%,100%,.1), inset -0.25px 0px 0px hsla(0,0%,100%,.1)',
         width: 'fit-content',
         icon: {
            marginInlineEnd: '{space.2}',
         },
         small: {
            padding: `{space.1} {space.3}`,
            fontSize: '{text.sm.fontSize}',
            lineHeight: '{text.sm.lineHeight}',
         },
         medium: {
            padding: `{space.2} {space.4}`,
            fontSize: '{text.base.fontSize}',
            lineHeight: '{text.base.lineHeight}',
         },
         large: {
            padding: `{space.2} {space.4}`,
            fontSize: '{text.lg.fontSize}',
            lineHeight: '{text.lg.lineHeight}',
         },
         giant: {
            padding: `{space.3} {space.5}`,
            fontSize: '{text.xl.fontSize}',
            lineHeight: '{text.xl.lineHeight}',
         },
      },
   }
})