Reference
Family - Rule
Unified reference for the Rule widget family across module, constructor, and element APIs.
Family - Rule
This page unifies related iced::widget APIs for the Rule family.
# API surfaces
- Module: iced::widget::rule
- Element: iced::widget::Rule
# Surface summaries
# Module
Rules divide space horizontally or vertically.
# Element
Display a horizontal or vertical rule for dividing content.
# Verified element declaration
rust
pub struct Rule<'a, Theme = Theme> where Theme: Catalog,{ /* private fields */ }
# Example References
- TODO(api-verify): add canonical example mapping for this item.
# Inline Examples (from rustdoc)
# Element example
rust
use iced::widget::rule; #[derive(Clone)] enum Message { // ..., } fn view(state: &State) -> Element<'_, Message> { rule::horizontal(2).into() }
# Related
# Use this when...
- You want one page that links module, constructor, and element surfaces.
- You are deciding which API surface to start from.
- You need a practical map for this widget domain.
# Minimal example
rust
// Typical flow: // 1) Start with constructor usage. // 2) Move to module docs for style/state details. // 3) Use element docs for type-level control.
# How it works
Family pages connect related docs so you do not miss capabilities that are split across constructor/module/element pages.
# Common patterns
rust
// Build with constructor APIs first, // then refine behavior/styles through related module and element docs.
# Gotchas / tips
- Family routes normalize naming; module/function/struct names may differ slightly.
- Prefer this page as your entrypoint when learning unfamiliar widgets.
- Follow example references here before inventing integration patterns.