slint/internal/compiler/widgets/material-base/widget-groupbox.slint

48 lines
1.3 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.0 OR LicenseRef-Slint-commercial
import { md } from "md.slint";
// A container widget with a title.
export component GroupBox {
in property <string> title <=> label.text;
in property<bool> enabled: true;
VerticalLayout {
spacing: 4px;
label := Text {
color: md.sys.color.on-surface;
// FIXME after Roboto font can be loaded
//font-family: md.sys.typescale.body-small.font;
font-size: md.sys.typescale.body-large.size;
font-weight: md.sys.typescale.body-small.weight;
overflow: elide;
horizontal-alignment: center;
}
container := Rectangle {
border-radius: 16px;
border-width: 1px;
border-color: md.sys.color.outline;
vertical-stretch: 1;
background: md.sys.color.surface;
HorizontalLayout {
padding: 16px;
GridLayout {
@children
}
}
}
}
states [
disabled when !root.enabled : {
container.border-color: md.sys.color.on-surface;
container.opacity: 0.38;
label.opacity: 0.38;
}
]
}