Skip to content

Expandable - Frameworks

Expandable is a layout component used for creating content that can be expanded and collapsed.

AndroidreleasedElementsreleasediOSreleasedReactreleasedVuereleased

iOS

Syntax

swift
// If you need a `Expandable` with a custom view use this
Warp.Expandable(
        style: Warp.ExpandableStyle,
        title: String,
        @ViewBuilder expandableView: () -> Content,
        isAnimated: Bool = true,
        isExpanded: Bool = false
)

// If you need a `Expandable` with a simple String use this instead
Warp.Expandable(
        style: Warp.ExpandableStyle,
        title: String,
        subtitle: String,
        isAnimated: Bool = true,
        isExpanded: Bool = false
)
swift
Warp.Expandable(
        style: .box,
        title: "Title",
        subtitle: "SubTitle"
)

Visual options

swift
enum Warp.ExpandableStyle {
    /// Basic expandable component with clear background.
    case `default`
    /// Expandable component with a boxed layout. Round corners
    case box
    /// Expandable component with a boxed layout. Square corners
    case boxBleed
}

Legacy support

By default all Warp components return a SwiftUI View but there is always a UIKit UIView available to use also.

swift
Warp.Expandable(
        style: .box,
        title: "Title",
        subtitle: "SubTitle"
).uiView

Parameters

Required props

NameTypeDefaultDescription
styleWarp.ExpandableStyleThe style of the Expandable. Use one of the predefined ExpandableStyle values: .default, .box, or .boxBleed
titleStringThe title for the top sticky part of the Expandable

Optional Props

NameTypeDefaultDescription
expandableViewViewThe view for the bottom hidden part of the Expandable. Either this or subtitle needs to be provided.
subtitleStringThe subtitle for the bottom hidden part of the Expandable. Either this or expandableView needs to be provided.
isAnimatedBooltrueDetermines if the Expandable will expand and collapse with animation
isExpandedBoolfalseControls the state of the Expandable

Questions?

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system