An interaction begins with an action and a visible response. Before adding animation, decide what the person can do and how the interface will acknowledge it. Here, the action is saving an idea.
Start with two states
Sketch the card before and after the click. The first state invites the action with “Save this idea.” The second says “Idea saved” and explains how to undo it. Keeping the text explicit makes the change easier to understand.
TRY IT
A tiny idea worth keeping.
Save this card to see its second state.
Use a real button
A button already supports keyboard activation. Give it a clear label and use aria-pressed when the same control toggles between two states.
<button id="save" aria-pressed="false">Save this idea</button>
Connect the state to the label
Read the current state, invert it, and update the label. A second click should undo the first. That gives the visitor a complete interaction to try.
const button = document.querySelector("#save");
button.addEventListener("click", () => {
const saved = button.getAttribute("aria-pressed") === "true";
button.setAttribute("aria-pressed", String(!saved));
button.textContent = saved ? "Save this idea" : "Idea saved";
});
Add feedback with purpose
Use a subtle border or background change to reinforce the new state. Keep the label readable, preserve the keyboard focus outline, and avoid relying on color alone. Test the button with Tab, Enter, and Space.
The example above keeps its state while this page stays open. Reloading starts the exercise again. For a real save feature, connect the interaction to the place where your product stores saved items.