Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Transitions and utilities

Zoom

Zooms its children in from the center. Shortcut for <Transition effect="zoom">.

import { Zoom } from "@stylhero/ui";

Example

Code
import { useState, type ReactNode } from "react";
import { Button, Paper, Stack, Zoom } from "@stylhero/ui";

function Toggle({ children }: { children: (show: boolean) => ReactNode }) {
  const [show, setShow] = useState(true);
  return (
    <Stack gap={3} align="flex-start">
      <Button size="sm" variant="secondary" onClick={() => setShow(!show)}>{show ? "Hide" : "Show"}</Button>
      {children(show)}
    </Stack>
  );
}

const panel = <Paper padding={4} outlined>Animated content</Paper>;

function ZoomExample() {
  return <Toggle>{(show) => <Zoom in={show}>{panel}</Zoom>}</Toggle>;
}

Props

PropTypeDefaultDescription
children required ReactNode -
in required boolean - Show or hide the children.
className string -
direction "up" | "down" | "left" | "right" -
duration number - ms.
keepMounted boolean - Keep the children in the DOM while hidden (default: removed after the exit animation).

Generated from src/components/Transitions.tsx. Something wrong or missing? Open an issue.