Skip to content

Commit 44a4101

Browse files
Better docs for Placeholder
1 parent 32af1dc commit 44a4101

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

crates/bevy_text/src/input.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
//! * [`TextInputAttributes`] - Common text input properties set by the user, such as font, font size, line height, justification, maximum characters etc.
2727
//! * [`TextInputFilter`] - Optional component that can be added to restrict the text input to certain formats, such as integers, decimals, hexadecimal etc.
2828
//! * [`PasswordMask`] - Optional component that can be added to hide the text input buffer contents by replacing the characters with a mask character.
29+
//! * [`Placeholder`] - Optional component that can be added to display placeholder text when the input buffer is empty.
2930
//!
3031
//! The [`TextInputBuffer`] component itself also has two fields that can be configured:
3132
//!
32-
//! - [`TextInputBuffer::space_advance`] - Space advance width for the current font, used to determine the width of the cursor when it is at the end of a line or when the buffer is empty.
33-
//! - [`TextInputBuffer::cursor_blink_timer`] - Controls cursor blinking.
33+
//! * [`TextInputBuffer::space_advance`] - Space advance width for the current font, used to determine the width of the cursor when it is at the end of a line or when the buffer is empty.
34+
//! * [`TextInputBuffer::cursor_blink_timer`] - Controls cursor blinking.
3435
//!
3536
//! ## Copy-paste and clipboard support
3637
//!
@@ -1124,8 +1125,12 @@ pub enum TextInputEvent {
11241125
TextChanged,
11251126
}
11261127

1127-
/// Placeholder text displayed when the input is empty (including whitespace).
1128-
/// Optional component.
1128+
/// Placeholder text displayed when the input is empty.
1129+
///
1130+
/// Text inputs that contain only whitespace (i.e spaces or tabs) are not empty.
1131+
///
1132+
/// This is an optional component, intended to work with [`TextInputTarget`].
1133+
/// The font and other properties are controlled with [`TextInputAttributes`].
11291134
#[derive(Default, Component, Clone, Debug, Reflect, Deref, DerefMut)]
11301135
#[reflect(Component, Default, Debug)]
11311136
#[require(PlaceholderLayout)]

0 commit comments

Comments
 (0)