This guide will walk you through creating your first feature with Attributes. You’ll build a copy-to-clipboard button that shows a success message when clicked.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/finsweet/attributes/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before starting, make sure you’ve installed Attributes in your project.What you’ll build
A button that copies text to the clipboard with:- Custom text to copy
- Visual feedback (active state)
- Success message
- Configurable duration
Step-by-step tutorial
Add the Copy Clip script
First, add the Attributes script with the
copyclip attribute to your page footer:Create the trigger button
Add a button with the copy trigger attribute:Let’s break down the attributes:
fs-copyclip-click- Marks this element as the copy triggerfs-copyclip-text- The text that will be copiedfs-copyclip-message- Success message shown to the user
Add visual feedback (optional)
Add a CSS class to show visual feedback when copying succeeds:Additional attributes:
fs-copyclip-activeclass- CSS class added during success state (default:is-copyclip-active)fs-copyclip-duration- How long the active state lasts in milliseconds (default:1000)
Complete example
Here’s a complete example with HTML and CSS:Advanced: Copy from another element
You can also copy text from another element instead of usingfs-copyclip-text:
When using
fs-copyclip-copy-this or fs-copyclip-copy-sibling, the fs-copyclip-text attribute is ignored.Try another attribute: Modal
Now that you understand the basics, let’s create a simple modal:fs-modal="{name}"- Defines the modal element with a unique namefs-modal-open="{name}"- Opens the modal with the matching namefs-modal-close- Closes the modal when clickedfs-modal-animation- Animation type:fade,slide-up,slide-down,grow, etc.fs-modal-duration- Animation duration in milliseconds
Understanding the attribute pattern
All Attributes follow a consistent naming pattern:fs-copyclip-click- Copy Clip’s click trigger elementfs-copyclip-text- Copy Clip’s text settingfs-modal-open- Modal’s open trigger elementfs-modal-animation- Modal’s animation setting
Next steps
Explore all attributes
Browse all 28 available attributes and their features
API reference
Learn about the JavaScript API for advanced control
Core concepts
Understand how Attributes work under the hood
Get support
Ask questions in the Finsweet community forum
Troubleshooting
Button doesn’t copy anything- Verify the script is loaded (check browser console for errors)
- Ensure
fs-copyclipattribute is on the script tag - Check that
fs-copyclip-clickis on the button - Confirm your browser supports the Clipboard API
- Verify
fs-modalattribute is on the script tag - Check that the
fs-modal-openvalue matches thefs-modalvalue exactly - Ensure the modal element has
display: noneinitially - Look for JavaScript errors in the browser console
- Verify the CSS class name matches the
fs-copyclip-activeclassvalue - Check that your CSS is properly loaded
- Inspect the element during the active state to see if the class is added
Open your browser’s developer console (F12) to see any error messages from Attributes. Most issues will show helpful error messages.