ion-datetime-button
Datetime Button links with a Datetime component to display the formatted date and time. It also provides buttons to present the datetime in a modal, popover, and more.
Overviewâ
Datetime Button should be used when space is constrained. This component displays buttons which show the current date and time values. When the buttons are tapped, the date or time pickers open in the overlay.
When using Datetime Button with a JavaScript framework such as Angular, React, or Vue be sure to use the keepContentsMounted property on ion-modal or the keepContentsMounted property on ion-popover. This allows the linked datetime instance to be mounted even if the overlay has not been presented yet.
Basic Usageâ
Localizationâ
The localized text on ion-datetime-button
is determined by the locale
property on the associated ion-datetime
instance. See Datetime Localization for more details.
Format Optionsâ
You can customize the format of the date and time in a Datetime Button by providing formatOptions
on the associated Datetime instance. See Datetime Format Options for more details.
Usage with Modals and Popoversâ
ion-datetime-button
must be associated with a mounted ion-datetime
instance. As a result, Inline Modals and Inline Popovers with the keepContentsMounted
property set to true
must be used.
Propertiesâ
colorâ
Description | The color to use from your application's color palette. Default options are: "primary" , "secondary" , "tertiary" , "success" , "warning" , "danger" , "light" , "medium" , and "dark" . For more information on colors, see theming. |
Attribute | color |
Type | "danger" īŊ "dark" īŊ "light" īŊ "medium" īŊ "primary" īŊ "secondary" īŊ "success" īŊ "tertiary" īŊ "warning" īŊ string īŊ undefined |
Default | 'primary' |
datetimeâ
Description | The ID of the ion-datetime instance associated with the datetime button. |
Attribute | datetime |
Type | string īŊ undefined |
Default | undefined |
disabledâ
Description | If true , the user cannot interact with the button. |
Attribute | disabled |
Type | boolean |
Default | false |
modeâ
Description | The mode determines which platform styles to use. |
Attribute | mode |
Type | "ios" īŊ "md" |
Default | undefined |
Eventsâ
No events available for this component.
Methodsâ
No public methods available for this component.
CSS Shadow Partsâ
Name | Description |
---|---|
native | The native HTML button that wraps the slotted text. |
CSS Custom Propertiesâ
No CSS custom properties available for this component.
Slotsâ
Name | Description |
---|---|
date-target | Content displayed inside of the date button. |
time-target | Content displayed inside of the time button. |