1// Copyright 2023 System76 <info@system76.com>
2// SPDX-License-Identifier: MPL-2.0
34//! A collection of tabs for developing a tabbed interface.
5//!
6//! See the [`segmented_button`] module for more details.
78use super::segmented_button::{
9self, HorizontalSegmentedButton, Model, SegmentedButton, Selectable, VerticalSegmentedButton,
10};
1112/// A collection of tabs for developing a tabbed interface.
13///
14/// The data for the widget comes from a model supplied by the application.
15///
16/// For details on the model, see the [`segmented_button`] module for more details.
17pub fn horizontal<SelectionMode: Default, Message>(
18 model: &Model<SelectionMode>,
19) -> HorizontalSegmentedButton<SelectionMode, Message>
20where
21Model<SelectionMode>: Selectable,
22{
23let space_s = crate::theme::spacing().space_s;
24let space_xs = crate::theme::spacing().space_xs;
2526 segmented_button::horizontal(model)
27 .minimum_button_width(76)
28 .maximum_button_width(250)
29 .button_height(44)
30 .button_padding([space_s, space_xs, space_s, space_xs])
31 .style(crate::theme::SegmentedButton::TabBar)
32 .font_active(Some(crate::font::semibold()))
33}
3435/// A collection of tabs for developing a tabbed interface.
36///
37/// The data for the widget comes from a model that is maintained the application.
38/// For details on the model, see the [`segmented_button`] module for more details.
39pub fn vertical<SelectionMode, Message>(
40 model: &Model<SelectionMode>,
41) -> VerticalSegmentedButton<SelectionMode, Message>
42where
43Model<SelectionMode>: Selectable,
44 SelectionMode: Default,
45{
46let space_s = crate::theme::spacing().space_s;
47let space_xs = crate::theme::spacing().space_xs;
4849 SegmentedButton::new(model)
50 .minimum_button_width(76)
51 .maximum_button_width(250)
52 .button_height(44)
53 .button_padding([space_s, space_xs, space_s, space_xs])
54 .style(crate::theme::SegmentedButton::TabBar)
55 .font_active(Some(crate::font::semibold()))
56}