mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(toolbar): add and document custom properties
This commit is contained in:
@ -62,6 +62,22 @@ The mode determines which platform styles to use.
|
|||||||
Possible values are: `"ios"` or `"md"`.
|
Possible values are: `"ios"` or `"md"`.
|
||||||
|
|
||||||
|
|
||||||
|
## CSS Custom Properties
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ------------------ | --------------------------------- |
|
||||||
|
| `--background` | Background of the toolbar |
|
||||||
|
| `--border-color` | Color of the toolbar border |
|
||||||
|
| `--border-style` | Style of the toolbar border |
|
||||||
|
| `--border-width` | Width of the toolbar border |
|
||||||
|
| `--color` | Color of the toolbar text |
|
||||||
|
| `--min-height` | Minimum height of the toolbar |
|
||||||
|
| `--opacity` | Opacity of the toolbar background |
|
||||||
|
| `--padding-bottom` | Bottom padding of the toolbar |
|
||||||
|
| `--padding-end` | End padding of the toolbar |
|
||||||
|
| `--padding-start` | Start padding of the toolbar |
|
||||||
|
| `--padding-top` | Top padding of the toolbar |
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -49,11 +49,20 @@
|
|||||||
<ion-toolbar color="dark">
|
<ion-toolbar color="dark">
|
||||||
<ion-title>Dark</ion-title>
|
<ion-title>Dark</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
<ion-toolbar class="custom">
|
||||||
|
<ion-title>Custom</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.custom {
|
||||||
|
--background: papayawhip;
|
||||||
|
--color: crimson;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -5,10 +5,9 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
--ion-color-base: #{$toolbar-ios-background-color};
|
--background: #{$toolbar-ios-background-color};
|
||||||
--ion-color-contrast: #{$toolbar-ios-text-color};
|
--color: #{$toolbar-ios-text-color};
|
||||||
--border-color: #{$toolbar-ios-border-color};
|
--border-color: #{$toolbar-ios-border-color};
|
||||||
--translucent-filter: #{$toolbar-ios-translucent-filter};
|
|
||||||
--padding-top: #{$toolbar-ios-padding};
|
--padding-top: #{$toolbar-ios-padding};
|
||||||
--padding-bottom: #{$toolbar-ios-padding};
|
--padding-bottom: #{$toolbar-ios-padding};
|
||||||
--padding-start: #{$toolbar-ios-padding};
|
--padding-start: #{$toolbar-ios-padding};
|
||||||
|
|||||||
@ -36,9 +36,6 @@ $toolbar-ios-button-strong-font-weight: 600 !default;
|
|||||||
/// @prop - Fill color of the toolbar button icon
|
/// @prop - Fill color of the toolbar button icon
|
||||||
$toolbar-ios-button-icon-fill-color: currentColor !default;
|
$toolbar-ios-button-icon-fill-color: currentColor !default;
|
||||||
|
|
||||||
/// @prop - Filter of the translucent toolbar
|
|
||||||
$toolbar-ios-translucent-filter: saturate(180%) blur(20px) !default;
|
|
||||||
|
|
||||||
|
|
||||||
// iOS Title
|
// iOS Title
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
--ion-color-base: #{$toolbar-md-background-color};
|
--background: #{$toolbar-md-background-color};
|
||||||
--ion-color-contrast: #{$toolbar-md-text-color};
|
--color: #{$toolbar-md-text-color};
|
||||||
--border-color: #{$toolbar-md-border-color};
|
--border-color: #{$toolbar-md-border-color};
|
||||||
--padding-top: #{$toolbar-md-padding};
|
--padding-top: #{$toolbar-md-padding};
|
||||||
--padding-bottom: #{$toolbar-md-padding};
|
--padding-bottom: #{$toolbar-md-padding};
|
||||||
@ -14,7 +14,7 @@
|
|||||||
--padding-end: #{$toolbar-md-padding};
|
--padding-end: #{$toolbar-md-padding};
|
||||||
--min-height: #{$toolbar-md-height};
|
--min-height: #{$toolbar-md-height};
|
||||||
|
|
||||||
font-family: #{$toolbar-md-font-family};
|
font-family: $toolbar-md-font-family;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,9 +4,21 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
|
/**
|
||||||
|
* @prop --background: Background of the toolbar
|
||||||
|
* @prop --border-color: Color of the toolbar border
|
||||||
|
* @prop --border-style: Style of the toolbar border
|
||||||
|
* @prop --border-width: Width of the toolbar border
|
||||||
|
* @prop --color: Color of the toolbar text
|
||||||
|
* @prop --min-height: Minimum height of the toolbar
|
||||||
|
* @prop --opacity: Opacity of the toolbar background
|
||||||
|
* @prop --padding-bottom: Bottom padding of the toolbar
|
||||||
|
* @prop --padding-end: End padding of the toolbar
|
||||||
|
* @prop --padding-start: Start padding of the toolbar
|
||||||
|
* @prop --padding-top: Top padding of the toolbar
|
||||||
|
*/
|
||||||
--border-width: 0;
|
--border-width: 0;
|
||||||
--border-style: solid;
|
--border-style: solid;
|
||||||
--background: #{current-color(base)};
|
|
||||||
--opacity: 1;
|
--opacity: 1;
|
||||||
|
|
||||||
@include font-smoothing();
|
@include font-smoothing();
|
||||||
@ -15,7 +27,7 @@
|
|||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
color: #{current-color(contrast)};
|
color: var(--color);
|
||||||
|
|
||||||
contain: content;
|
contain: content;
|
||||||
|
|
||||||
@ -23,6 +35,14 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:host(.ion-color) {
|
||||||
|
color: current-color(contrast);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.ion-color) .toolbar-background {
|
||||||
|
background: current-color(base);
|
||||||
|
}
|
||||||
|
|
||||||
.toolbar-container {
|
.toolbar-container {
|
||||||
@include padding(
|
@include padding(
|
||||||
var(--padding-top),
|
var(--padding-top),
|
||||||
|
|||||||
Reference in New Issue
Block a user