Toolkit / UI library / HeroUI / Toggle button Toggle button A button that stays pressed when you click it and lets go on the next click.
Add it to your project Or install the packages yourself Terminal Copy
npm install @heroui/react lucide-react First time with HeroUI? Set it up once .
The code * controls; lucide-react icons instead of @gravity-ui/icons.
*/
import {Heart} from "lucide-react";
import {ToggleButton} from "@heroui/react";
export default function ToggleButtonDemo() {
return (
<ToggleButton>
<Heart size={16} />
Like
</ToggleButton>
); This comes with paid plans The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.
Changed for this site: A default export (HeroUI's docs use named ones) without the docs site's prop controls; lucide-react icons instead of @gravity-ui/icons.
From HeroUI, Apache-2.0 licence. Copyright 2025 NextUI Inc. (HeroUI). Apache License 2.0: keep this notice and the licence text when you copy the code, and say what you changed. HeroUI has no NOTICE file. Read the licence or see the original .