Skip to content

Animated Outline Button

Border that animates on hover with color transition

Animated Outline Button

by FreeCsStyles Dev's

OutlineModern
🌐🎨⚛️💚🅰️🔥☁️
#outline#border#animated#ghost#secondary#clean

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/outline-button.

<iframe src="/embed/outline-button" sandbox="allow-scripts" loading="lazy" title="Animated Outline Button" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Animated Outline Button, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.

HTML
<button class="outline-button">Outline</button>
CSS
.outline-button {
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  background: transparent;
  border: 2px solid #a855f7;
  color: #a855f7;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.outline-button:hover {
  background: #a855f7;
  color: white;
  transform: scale(1.05);
}
Tailwind CSS
<button class="px-8 py-4 rounded-xl border-2 border-purple-500 text-purple-500 font-semibold transition-all hover:bg-purple-500 hover:text-white hover:scale-105">
  Outline
</button>
LWC — HTML template
<template>
  <button class="outline-button" onclick={handleClick}>
    <slot>Outline</slot>
  </button>
</template>
LWC — JavaScript
import { LightningElement, api } from 'lwc';

export default class OutlineButton extends LightningElement {
  @api label = 'Outline';
  
  handleClick() {
    this.dispatchEvent(new CustomEvent('buttonclick', {
      bubbles: true,
      composed: true
    }));
  }
}
LWC — CSS
.outline-button {
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  background: transparent;
  border: 2px solid #a855f7;
  color: #a855f7;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.outline-button:hover {
  background: #a855f7;
  color: white;
  transform: scale(1.05);
}
LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
  <apiVersion>59.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
  </targets>
</LightningComponentBundle>

Where Animated Outline Button fits

  • Secondary Actions
  • Ghost Buttons
  • Clean UI
  • Forms

Interaction states & animations

  • Hover
  • Border

Topics

  • #outline
  • #border
  • #animated
  • #ghost
  • #secondary
  • #clean

Accessibility notes

Ensure border color meets contrast requirements. Add background on focus.

Browser support

  • All modern browsers