Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/api/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import ShowAdjacentDays from '@site/static/usage/v8/datetime/show-adjacent-days/
import MultipleDateSelection from '@site/static/usage/v8/datetime/multiple/index.md';

import GlobalTheming from '@site/static/usage/v8/datetime/styling/global-theming/index.md';
import CalendarHeaderStyling from '@site/static/usage/v8/datetime/styling/calendar-header/index.md';
import CalendarDaysStyling from '@site/static/usage/v8/datetime/styling/calendar-days/index.md';
import WheelStyling from '@site/static/usage/v8/datetime/styling/wheel-styling/index.md';

Expand Down Expand Up @@ -352,6 +353,14 @@ The benefit of this approach is that every component, not just `ion-datetime`, c

<GlobalTheming />

### Calender Header

The calendar header manages the date navigation controls (month/year picker and prev/next buttons) and the days of the week when using a grid style layout.

The header can be styled using CSS shadow parts.

<CalendarHeaderStyling />

### Calendar Days

The calendar days in a grid-style `ion-datetime` can be styled using CSS shadow parts.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```css
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```html
<ion-datetime presentation="date"></ion-datetime>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```ts
import { Component } from '@angular/core';
import { IonDatetime } from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['./example.component.css'],
imports: [IonDatetime],
})
export class ExampleComponent {}
```
33 changes: 33 additions & 0 deletions static/usage/v7/datetime/styling/calendar-header/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Datetime</title>
<link rel="stylesheet" href="../../../common.css" />
<script src="../../../common.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@7/dist/ionic/ionic.esm.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@7/css/ionic.bundle.css" />

<style>
/*
* Custom Datetime Calendar Header Parts
* -------------------------------------------
*/

ion-datetime::part(month-year-button) {
background-color: lightblue;
}
</style>
</head>

<body>
<ion-app>
<ion-content>
<div class="container">
<ion-datetime presentation="date"></ion-datetime>
</div>
</ion-content>
</ion-app>
</body>
</html>
35 changes: 35 additions & 0 deletions static/usage/v7/datetime/styling/calendar-header/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Playground from '@site/src/components/global/Playground';

import javascript from './javascript.md';

import react_main_tsx from './react/main_tsx.md';
import react_main_css from './react/main_css.md';

import vue from './vue.md';

import angular_example_component_html from './angular/example_component_html.md';
import angular_example_component_css from './angular/example_component_css.md';
import angular_example_component_ts from './angular/example_component_ts.md';

<Playground
version="7"
code={{
javascript,
react: {
files: {
'src/main.tsx': react_main_tsx,
'src/main.css': react_main_css,
},
},
vue,
angular: {
files: {
'src/app/example.component.html': angular_example_component_html,
'src/app/example.component.css': angular_example_component_css,
'src/app/example.component.ts': angular_example_component_ts,
},
},
}}
src="usage/v7/datetime/styling/calendar-header/demo.html"
size="medium"
/>
13 changes: 13 additions & 0 deletions static/usage/v7/datetime/styling/calendar-header/javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```html
<ion-datetime presentation="date"></ion-datetime>

<style>
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
</style>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```css
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```tsx
import React from 'react';
import { IonDatetime } from '@ionic/react';

import './main.css';

function Example() {
return (
<>
<IonDatetime presentation="date"></IonDatetime>
</>
);
}
export default Example;
```
19 changes: 19 additions & 0 deletions static/usage/v7/datetime/styling/calendar-header/vue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```html
<template>
<ion-datetime presentation="date"></ion-datetime>
</template>

<script setup lang="ts">
import { IonDatetime } from '@ionic/vue';
</script>

<style scoped>
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
</style>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```css
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```html
<ion-datetime presentation="date"></ion-datetime>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```ts
import { Component } from '@angular/core';
import { IonDatetime } from '@ionic/angular/standalone';

@Component({
selector: 'app-example',
templateUrl: 'example.component.html',
styleUrls: ['./example.component.css'],
imports: [IonDatetime],
})
export class ExampleComponent {}
```
33 changes: 33 additions & 0 deletions static/usage/v8/datetime/styling/calendar-header/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Datetime</title>
<link rel="stylesheet" href="../../../common.css" />
<script src="../../../common.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@8/dist/ionic/ionic.esm.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@8/css/ionic.bundle.css" />

<style>
/*
* Custom Datetime Calendar Header Parts
* -------------------------------------------
*/

ion-datetime::part(month-year-button) {
background-color: lightblue;
}
</style>
</head>

<body>
<ion-app>
<ion-content>
<div class="container">
<ion-datetime presentation="date"></ion-datetime>
</div>
</ion-content>
</ion-app>
</body>
</html>
35 changes: 35 additions & 0 deletions static/usage/v8/datetime/styling/calendar-header/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Playground from '@site/src/components/global/Playground';

import javascript from './javascript.md';

import react_main_tsx from './react/main_tsx.md';
import react_main_css from './react/main_css.md';

import vue from './vue.md';

import angular_example_component_html from './angular/example_component_html.md';
import angular_example_component_css from './angular/example_component_css.md';
import angular_example_component_ts from './angular/example_component_ts.md';

<Playground
version="8"
code={{
javascript,
react: {
files: {
'src/main.tsx': react_main_tsx,
'src/main.css': react_main_css,
},
},
vue,
angular: {
files: {
'src/app/example.component.html': angular_example_component_html,
'src/app/example.component.css': angular_example_component_css,
'src/app/example.component.ts': angular_example_component_ts,
},
},
}}
src="usage/v8/datetime/styling/calendar-header/demo.html"
size="medium"
/>
13 changes: 13 additions & 0 deletions static/usage/v8/datetime/styling/calendar-header/javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```html
<ion-datetime presentation="date"></ion-datetime>

<style>
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
</style>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```css
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```tsx
import React from 'react';
import { IonDatetime } from '@ionic/react';

import './main.css';

function Example() {
return (
<>
<IonDatetime presentation="date"></IonDatetime>
</>
);
}
export default Example;
```
19 changes: 19 additions & 0 deletions static/usage/v8/datetime/styling/calendar-header/vue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```html
<template>
<ion-datetime presentation="date"></ion-datetime>
</template>

<script setup lang="ts">
import { IonDatetime } from '@ionic/vue';
</script>

<style scoped>
/*
* Custom Datetime Calendar Header Part
* -------------------------------------------
*/
ion-datetime::part(month-year-button) {
background-color: lightblue;
}
</style>
```
7 changes: 7 additions & 0 deletions versioned_docs/version-v7/api/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import HighlightedDatesCallback from '@site/static/usage/v7/datetime/highlighted
import MultipleDateSelection from '@site/static/usage/v7/datetime/multiple/index.md';

import GlobalTheming from '@site/static/usage/v7/datetime/styling/global-theming/index.md';
import CalendarHeaderStyling from '@site/static/usage/v7/datetime/styling/calendar-header/index.md';
import CalendarDaysStyling from '@site/static/usage/v7/datetime/styling/calendar-days/index.md';
import WheelStyling from '@site/static/usage/v7/datetime/styling/wheel-styling/index.md';

Expand Down Expand Up @@ -341,6 +342,12 @@ The benefit of this approach is that every component, not just `ion-datetime`, c

<GlobalTheming />

### Calender Header

The calendar header manages the date navigation controls (month/year picker and prev/next buttons) and the days of the week when using a grid style layout.

<CalendarHeaderStyling />

### Calendar Days

The calendar days in a grid-style `ion-datetime` can be styled using CSS shadow parts.
Expand Down