A customizable, animated word art web component built with Svelte. Perfect for adding eye-catching text animations to your web applications.
npm install @codeweaver/wordart
// Import in your JavaScript/TypeScript file
import "@codeweaver/wordart";
// Use in your HTML
<wordart-widget name="Hello World"></wordart-widget>;
<!-- Load Svelte first -->
<script src="https://unpkg.com/svelte@4"></script>
<!-- Load our component -->
<script src="https://unpkg.com/@codeweaver/[email protected]/wordart.umd.js"></script>
<!-- Use the component -->
<wordart-widget
name="Hello World"
size="3"
speed="2"
color1="#ff3e00"
color2="#40b3ff"
></wordart-widget>
<script type="module">
import "@codeweaver/wordart/wordart.es.js";
</script>
<wordart-widget name="Hello World"></wordart-widget>
<!-- Latest version -->
<script src="https://unpkg.com/@codeweaver/wordart"></script>
<!-- Specific version -->
<script src="https://unpkg.com/@codeweaver/[email protected]/wordart.umd.js"></script>
<script>
import '@codeweaver/wordart';
</script>
<wordart-widget name="Hello Svelte!"></wordart-widget>
import "@codeweaver/wordart";
function App() {
return (
<wordart-widget name="Hello React!" size="3" speed="2"></wordart-widget>
);
}
<template>
<wordart-widget name="Hello Vue!" size="3" speed="2"></wordart-widget>
</template>
<script>
import "@codeweaver/wordart";
export default {
name: "App",
};
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WordArt Demo</title>
<!-- Required Dependencies -->
<script src="https://unpkg.com/svelte@4"></script>
<script src="https://unpkg.com/@codeweaver/[email protected]/wordart.umd.js"></script>
</head>
<body>
<h1>WordArt Demo</h1>
<!-- Basic Usage -->
<wordart-widget
name="Hello World"
size="3"
speed="2"
color1="#ff3e00"
color2="#40b3ff"
shouldConvertToUpperCase="false"
></wordart-widget>
<!-- Interactive Example -->
<script>
// You can dynamically update properties
const widget = document.querySelector("wordart-widget");
// Update text after 2 seconds
setTimeout(() => {
widget.setAttribute("name", "Dynamic Update!");
widget.setAttribute("color1", "#00ff00");
}, 2000);
</script>
</body>
</html>
Property | Type | Default | Description |
---|---|---|---|
name |
string | "" |
Text to be displayed |
size |
string | "3" |
Font size in rem units |
speed |
string | "2" |
Animation duration in seconds |
color1 |
string | "#ff3e00" |
Primary color |
color2 |
string | "#40b3ff" |
Secondary color |
font |
string | "Rubik Doodle Shadow" |
Font family |
shouldConvertToUpperCase |
boolean | false |
Convert text to uppercase |
The widget uses Google Fonts. If you're using CSP (Content Security Policy), make sure to allow:
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossorigin="anonymous"
/>
<link
href="https://fonts.googleapis.com/css2?family=Bungee+Shade&family=Nabla&family=Pixelify+Sans&family=Rubik+Doodle+Shadow&family=Rubik+Vinyl&display=swap"
rel="stylesheet"
/>
Clone and install dependencies:
git clone https://github.com/jaywalker21/wordart.git
cd wordart
npm install
Available scripts:
# Start development server with demo
npm run dev
# Build the library
npm run build:lib
# Build the demo site
npm run build:demo
# Preview the built demo
npm run preview:demo
# Type checking
npm run check
.
āāā src/
ā āāā lib/ # Library source code
ā ā āāā WordArt.svelte # Main component
ā ā āāā index.ts # Library entry point
ā āāā demo/ # Demo site source
ā ā āāā App.svelte # Demo page
ā āāā main.ts # Demo entry point
āāā dist/ # Built library output
āāā demo-dist/ # Built demo site
āāā package.json
Supports all modern browsers that implement the Custom Elements v1 specification:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)MIT License - see the LICENSE file for details.
Made with ā¤ļø using Claude