-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting placeholder text for text input
- Loading branch information
1 parent
918b2e9
commit 9425316
Showing
4 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
use crate::{ | ||
style_class, | ||
view::View, | ||
views::{self, Decorators}, | ||
views::{self, Decorators, TextInput}, | ||
}; | ||
use floem_reactive::RwSignal; | ||
|
||
style_class!(pub TextInputClass); | ||
style_class!(pub PlaceholderTextClass); | ||
|
||
pub fn text_input(buffer: RwSignal<String>) -> impl View { | ||
pub fn text_input(buffer: RwSignal<String>) -> TextInput { | ||
views::text_input(buffer).class(TextInputClass) | ||
} | ||
|
||
impl TextInput { | ||
pub fn placeholder(mut self, text: impl Into<String>) -> Self { | ||
self.placeholder_text = Some(text.into()); | ||
self | ||
} | ||
} |