Skip to main content

Crate iced_plus_layouts

Crate iced_plus_layouts 

Source
Expand description

Layout primitives for iced-plus.

This crate provides type-safe layout components with direction-aware alignment constraints and compile-time guarantees.

§Key Types

  • HStack - Horizontal stack layout (left to right)
  • VStack - Vertical stack layout (top to bottom)
  • AppShell - Application shell with sidebar and header areas
  • Modal - Modal overlay with backdrop
  • Breakpoints - Responsive breakpoint definitions
  • ShowOn - Show content only at certain breakpoints

§Type Safety

The direction is encoded in the type system:

  • HStack only accepts Vertical cross-axis alignment
  • VStack only accepts Horizontal cross-axis alignment

This prevents mistakes like trying to set horizontal alignment on an HStack.

§Responsive Layouts

Use breakpoint helpers to create adaptive UIs:

use iced_plus_layouts::{ShowOn, BreakpointTier};

// Only show on medium screens and up
ShowOn::new(sidebar).min(BreakpointTier::MD)

§Example

use iced_plus_layouts::{HStack, VStack};
use iced::alignment;

let layout = VStack::new()
    .spacing(16.0)
    .align(alignment::Horizontal::Center)  // Type-safe!
    .push(text("Hello"))
    .push(text("World"));

Structs§

AppShell
Application shell with sidebar and main content areas.
Breakpoints
Standard breakpoint values in pixels.
Horizontal
Horizontal direction (left to right).
Modal
Modal builder for more control over the overlay.
Responsive
Responsive value that changes based on breakpoint.
ResponsiveRow
A responsive row that stacks vertically on small screens.
ShowOn
A wrapper that shows content only at certain breakpoints.
Stack
A stack layout that arranges children in a single direction.
Vertical
Vertical direction (top to bottom).

Enums§

BreakpointTier
Breakpoint tier enum for pattern matching.

Traits§

Direction
Trait for layout directions with associated cross-axis alignment.

Functions§

drawer
Creates a drawer overlay that slides in from the side.
drawer_left
Creates a drawer overlay from the left with custom width.
drawer_right
Creates a drawer overlay from the right with custom width.
hide_on
Convenience function to hide content on certain breakpoints.
modal
Creates a modal overlay that displays content over a backdrop.
modal_with_opacity
Creates a modal overlay with custom backdrop opacity.
responsive_row
Convenience function to create a responsive row.
show_on
Convenience function to create a ShowOn wrapper.

Type Aliases§

HStack
Horizontal stack (left to right).
VStack
Vertical stack (top to bottom).