Button
テキストなどの内容を自由に組み合わせてスタイルできる、アクセシブルな押下ターゲットです。
デモを読み込み中…
button()
.h(40.0)
.px(16.0)
.bg(Color::rgb8(37, 99, 235))
.text_color(Color::WHITE)
.rounded(8.0)
.hover(|style| style.bg(Color::rgb8(59, 130, 246)))
.on_click(save)
.child("Save changes")#インポート
quickgui から button をインポートします。
use quickgui::*;#使い方
button()
.h(40.0)
.px(16.0)
.bg(Color::rgb8(37, 99, 235))
.text_color(Color::WHITE)
.rounded(8.0)
.hover(|style| style.bg(Color::rgb8(59, 130, 246)))
.on_click(save)
.child("Save changes")#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
button
ソースを見るpub fn button() -> ElementCreate a semantic, keyboard-focusable button container.
on_clickpub fn on_click<V>(mut self, listener: crate::ClickListener<V>) -> Self—
Attach a listener registered by [`crate::ViewContext::listener`].
pub fn on_click<V>(mut self, listener: crate::ClickListener<V>) -> Selfソースを見るdisabledpub fn disabled(mut self, disabled: bool) -> Self—
childpub fn child(mut self, child: impl IntoElement) -> Self—
hpub fn h(mut self, height: f32) -> Self—
pxpub fn px(mut self, value: f32) -> Self—
bgpub fn bg(mut self, color: Color) -> Self—
roundedpub fn rounded(mut self, radius: f32) -> Self—
hoverpub fn hover(mut self, style: impl FnOnce(ElementStateStyle) -> ElementStateStyle) -> Self—
Configures hover for this part.
pub fn hover(mut self, style: impl FnOnce(ElementStateStyle) -> ElementStateStyle) -> Selfソースを見る