pub enum ButtonType {
Submit,
Reset,
Button,
}Expand description
The type attribute values for <button> elements.
§Purpose
Defines the behavior of a button element, determining how it interacts with forms and what action it performs when activated.
§Usage Context
- Used with:
<button>elements only - Default:
submitif not specified and button is in a form - Form association: Submit and reset affect the associated form
§Valid Values
Submit: Submits the form when clickedReset: Resets the form to default valuesButton: No default behavior (for custom JavaScript)
§Example
use ironhtml_attributes::{AttributeValue, ButtonType};
let btn_type = ButtonType::Submit;
assert_eq!(btn_type.to_attr_value(), "submit");<button type="submit">Submit Form</button>
<button type="reset">Reset Form</button>
<button type="button" onclick="handleClick()">Custom Action</button>§WHATWG Specification
Variants§
Submit
Submit button that submits the form when activated. This is the default if the button is within a form.
Reset
Reset button that resets all form controls to their initial values.
Button
Regular button with no default behavior. Use with JavaScript event handlers for custom functionality.
Trait Implementations§
Source§impl AttributeValue for ButtonType
impl AttributeValue for ButtonType
Source§fn to_attr_value(&self) -> Cow<'static, str>
fn to_attr_value(&self) -> Cow<'static, str>
Convert to the attribute value string.
Source§impl Clone for ButtonType
impl Clone for ButtonType
Source§fn clone(&self) -> ButtonType
fn clone(&self) -> ButtonType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ButtonType
impl Debug for ButtonType
Source§impl PartialEq for ButtonType
impl PartialEq for ButtonType
impl Copy for ButtonType
impl Eq for ButtonType
impl StructuralPartialEq for ButtonType
Auto Trait Implementations§
impl Freeze for ButtonType
impl RefUnwindSafe for ButtonType
impl Send for ButtonType
impl Sync for ButtonType
impl Unpin for ButtonType
impl UnwindSafe for ButtonType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more