uselayouts

repository·main·Indexed 19 days ago

https://github.com/iurvish/uselayouts

A micro-interaction UI library providing animated React components built with Framer Motion and Tailwind CSS. Designed for compatibility with Shadcn UI, it offers a collection of premium components—such as 3D Book, Bento Card, and Bottom Menu—that can be installed via the Shadcn CLI or manually.

Tokens
15K
Snippets
81
Records
98
Agent score
63%

What's inside uselayouts

  1. Introduction to uselayouts

    main

    uselayouts is a collection of premium, highly-polished layout components and micro-interactions designed to provide high-end motion and aesthetics for web applications.

    Instead of using heavy library wrappers, uselayouts provides copy-pasteable code blocks that allow you to own the implementation. This approach focuses on the 'hard parts' of UI development: coordinating motion, managing responsive layouts, and implementing subtle premium details.

    Key Characteristics

    • Built for Speed: Components are designed to be copied and pasted directly into your project without complex dependency management.
    • Modern Stack: The components are built using React 19, Tailwind CSS 4, and Motion.
    • Full Control: Because the code resides directly in your project, you have complete control over every animation and style.
  2. Overview of uselayouts features

    main

    uselayouts is a micro-interaction UI library for React that provides animated components built with Framer Motion and Tailwind CSS.

    Key characteristics include:

    • Shadcn Compatible: Designed to integrate with existing Shadcn UI setups.
    • Premium Animations: Uses Framer Motion for smooth transitions.
    • Micro-interactions: Focuses on fine UX details.
    • Customizable: Components are fully stylable using Tailwind CSS classes.
    • Accessible: Built on top of accessible primitives.
  3. Status Button features

    main

    The Status Button component provides the following capabilities:

    • Multi-state: Handles Idle, Loading, and Success states in a single component.
    • Text Morphing: Smooth character-level transitions for label changes.
    • Visual Feedback: Icons and colors update dynamically to reflect current status.
    • Interaction Safety: Disabled state during loading prevents duplicate submissions.
    • Accessibility: ARIA-friendly state management.
  4. FolderInteraction features

    main

    The FolderInteraction component provides the following interactive capabilities:

    • 3D folder opening: Realistic folder flip animation using perspective.
    • Document fan-out: Three documents that spread out using staggered spring animations.
    • Glassmorphism: A frosted glass effect on the folder front utilizing backdrop-filter.
    • Click to toggle: The folder opens and closes upon clicking.
    • SVG folder design: Custom SVG folder shape with gradient fills.
  5. Features of the 3D Book component

    main

    The 3D Book component provides the following capabilities:

    • 3D Perspective: Uses CSS 3D transforms for realistic book cover and page depth.
    • Interactivity: Opens responsively via hover or drag interactions.
    • Performance: Implemented using pure CSS/JS, avoiding heavy WebGL dependencies.
    • Responsiveness: Adapts to container size for both desktop and mobile.
    • Customizability: Allows for easy swapping of cover art and page content.
  6. Features of Inline Edit

    main

    The Inline Edit component provides:

    • Read/Edit Modes: Distinct visual states for viewing and editing content.
    • Seamless Transition: Smooth morphing animation between text display and input field.
    • Contextual Actions: Edit and Save buttons appear only when relevant.
    • Focus Management: Automatically focuses the input field when entering edit mode.
    • Visual Feedback: Ring and shadow effects indicate active editing state.
  7. Feature Carousel capabilities

    main

    The FeatureCarousel component provides the following built-in behaviors:

    • Floating Chips: Interactive feature chips that float on the left/top.
    • Scroll Tracking: Automatically scrolls to the active feature.
    • Synchronized Visuals: Updates the central image card based on the selected feature.
    • Auto-play: Automatically cycles through features (pauses on hover).
    • Smooth Animations: Uses spring physics for smooth transitions.
  8. How the Magnified Bento reveal effect works

    main

    The component uses a Revealing Lens approach involving two synchronized layers:

    1. The Base Layer: This layer is always visible but uses an inverseMask. This mask makes the base chips disappear exactly where the magnifying lens is positioned, preventing visual overlap.
    2. The Reveal Layer: A 'secret' layer containing larger chips (scale-125). This layer is only visible through the clipPath of the lens.
    3. The Lens: A draggable motion.div that tracks lensX and lensY. These coordinates are fed into the clipPath and maskImage templates to ensure the magnification effect is perfectly synced with the lens position.

    Both layers use the same transition duration (defaulting to 25s) to ensure the infinite scroll animations remain perfectly aligned while providing the zoom effect.

  9. How the Bucket component works

    main

    The Bucket component achieves a high-fidelity 3D effect through several technical layers:

    Layered Depth

    The component uses a stacked SVG approach to simulate depth:

    • Base Layer: The back and bottom of the bucket with gradients.
    • Middle Layer: The container for the active motion.div chip.
    • Top Layer: A translucent front cover with backdrop-blur that makes chips appear to fall into the container.

    Animation Logic

    • Toss Effect: Uses Framer Motion's AnimatePresence with mode="popLayout". Every 2 seconds, the first item in the array is moved to the end.
    • Lifecycle: Chips enter with opacity: 0 from above and exit by falling further down out of the bucket.

    Visual Effects

    • SVG Filters: Used for inner shadows (to create rounded 3D edges) and multi-stage dropshadows.
    • Glassmorphism: High-radius blurs on the front face create a premium glass finish.

    Responsiveness

    The component uses a useIsMobile hook to dynamically scale chips and adjust animation travel distances for smaller screens.

  10. How the Empty Testimonial component works

    main

    The EmptyTestimonial component uses several techniques to create a high-quality interactive empty state:

    • Folder Animation: Uses Framer Motion to rotate the front flap of an animated file folder, revealing internal "pages" when clicked.
    • Spring Physics: Employs type: "spring" animations for the pages to provide a natural, tactile sliding and spreading effect.
    • SVG Detailing: Utilizes custom SVG paths for the folder flap, including procedural details like rivets and label slots.
    • Interactive Elements: Features a magnetic-like hover effect on the "Wall of Love" heading and a styled call-to-action link.
    • Theming: Integrates with Tailwind CSS using standard color tokens like primary, foreground, and muted-foreground.