4.0.0-beta.15
Breaking Changes
Removed Global CSS Variables
The following global CSS variables have been removed for the reasons listed.
Variable Name | Reason |
---|---|
--ion-toolbar-color-inactive |
Unused |
--ion-ripple-background-color |
Unused / Ripple color is based on component |
--ion-header-size |
Removed in favor of using CSS for h1-h6 |
--ion-header-step |
Removed in favor of using CSS for h1-h6 |
Renamed Global CSS Variables
The following global CSS variables have been renamed for the reasons listed.
Old Variable Name | New Variable Name | Reason |
---|---|---|
--ion-toolbar-text-color |
--ion-toolbar-color |
Variable is not limited to text color |
--ion-toolbar-color-active |
--ion-toolbar-color-activated |
Consistency with our component variables |
--ion-tabbar-text-color |
--ion-tab-bar-color |
Variable is not limited to text color |
--ion-tabbar-text-color-active |
--ion-tab-bar-color-activated |
Consistency with our component variables |
--ion-tabbar-background-color |
--ion-tab-bar-background |
Applies to the background property |
--ion-tabbar-background-color-focused |
--ion-tab-bar-background-focused |
Applies to the background property |
--ion-item-background-color |
--ion-item-background |
Applies to the background property |
--ion-item-background-color-active |
--ion-item-background-activated |
Applies to the background property / Consistency with our component variables |
--ion-item-text-color |
--ion-item-color |
Variable is not limited to text color |
--ion-placeholder-text-color |
--ion-placeholder-color |
Consistency with other variables |
Rethinking Tabs
One of the most valuable and complex components in Ionic's toolkit is Tabs. Tabs started off as a simple component that would create a tabbed interface to allow users to switch between different views in a way that was consistent with native UX paradigms.
Over time, we started hearing people ask for more features to be added: "Can we have one tab button that is just a button?" "Can I customize how the tab buttons are displayed?" "Can I use a custom icon in the tab?"
Traditionally, these features, and many others, were difficult to accomplish because Tabs was doing a lot of magic behind the scenes to generate the Tab bar and buttons. With this in mind, we thought it was time for a refresh to offer as much flexibility as possible within Tabs.
In order to do this, we had to change how Tabs were written in an app. Prior to Beta 14, Tabs would look like this:
<ion-tabs>
<ion-tab label="Home" icon="home" href="/tabs/(home:home)">
<ion-router-outlet name="home"></ion-router-outlet>
</ion-tab>
<ion-tab label="About" icon="information-circle" href="/tabs/(about:about)">
<ion-router-outlet name="about"></ion-router-outlet>
</ion-tab>
<ion-tab label="Contact" icon="contacts" href="/tabs/(contact:contact)">
<ion-router-outlet name="contact"></ion-router-outlet>
</ion-tab>
</ion-tabs>
Here, we have an ion-tab
element that accepts an icon, a label, and a link to navigate to as properties. This is pretty much how Tabs have worked all the way back to Ionic 1. In Beta 14, we've removed some of the magic from Tabs which allows for more customization:
<ion-tabs>
<ion-tab-bar>
<!-- No ion-tab, just a link that looks like a tab -->
<ion-tab-button href=”https://beta.ionicframework.com”>
<!-- <a href=”https://beta.ionicframework.com”> -->
<ion-icon name="globe"></ion-icon>
<ion-label>Schedule</ion-label>
</ion-tab-button>
<!-- No ion-tab, just a button that looks like a tab -->
<ion-tab-button (click)=”openCamera()”>
<ion-icon name="camera"></ion-icon>
<ion-label>Photo</ion-label>
</ion-tab-button>
<!-- Connected to ion-tab, on click will show the ion-tab with id home-view -->
<ion-tab-button tab=”home-view”>
<ion-icon name="home"></ion-icon>
<ion-label>Home</ion-label>
</ion-tab-button>
</ion-tab-bar>
<ion-tab tab=”home-view”>
<ion-content></ion-content>
<!-- or -->
<ion-nav></ion-nav>
<!-- or -->
<ion-router-outlet></ion-router-outlet>
</ion-tab>
</ion-tabs>
There's a lot going on here, so let's break it down:
- A single parent
ion-tabs
wraps the entire layout. Same as before. - A new element,
ion-tab-bar
, creates the Tab Bar which will contain buttons. - A new element,
ion-tab-button
, is used to create each button in the Tab Bar. These could be static links to different routes, buttons with click handlers on them, or link to whole tab views. - The
ion-tab
component becomes a separate container that has inline content (ion-content
), a navigation component (ion-nav
) or a router outlet (ion-router-outlet
).
To connect the ion-tab-button
to the ion-tab
, the tab
property must be added to both of these components. For example:
<ion-tabs>
<ion-tab-bar>
<ion-tab-button tab=”home-view”></ion-tab-button>
</ion-tab-bar>
<ion-tab tab=”home-view”></ion-tab>
</ion-tabs>
Since the tab
property is the same on the ion-tab-button
and ion-tab
, when the Tab Button is tapped, the home-view
Tab will become active. This takes the magic out of Tabs while making the behavior between the tab buttons and the views much more explicit.
Some other benefits of this refactor include:
- Can now be written as a standalone Tab Bar (with no attached Tab)
- Works with a navigation component or a plain content element
- Works with shadow DOM and allows easy customization of the Tab Bar
- Gives full control over the elements inside of the Tab Bar
- Integrates nicely with other frameworks that have different ways of rendering element nodes
Lastly, this change also fixes some outstanding issues with Tabs, so we're excited to get this out to you all!
Bug Fixes
- action-sheet: update Action Sheet design to match MD spec (#16135) (068303d)
- alert: match MD spec (#16145) (287aec8)
- alert: update alert min/max interface (#15987) (a0c60ff), closes #15986
- angular: generate proxies for ion-tabbar (#15954) (45b46b4)
- angular: make sure angular form control onChange is fired when needed (#16126) (d5f2e6f)
- badge: match MD padding (#16134) (615c518)
- button: match MD spec timing, outline, hover (#16160) (0faa355)
- button: match updated MD specs (#16144) (e9579d5)
- card: adjust styles to match MD (#16093) (44b0eab)
- checkbox: end position by default (9da51b3)
- cordova: fix resume event in cordova browser (#15945) (4318520), closes #15944
- datetime: can participate in native (#16106) (aad7711), closes #16075
- datetime: pickerOptions are all optional (#16101) (f014181), closes #16095
- fab-button: use correct background in list and update the md icon color (#16092) (9dfc863), closes #16091
- header: update box shadow to match MD spec (#16149) (00544e9)
- infinite-scroll: disabled resets loading/busy state (#16107) (33448c6), closes #15994
- inputs: add z-index for all inputs (92ee4ef), closes #16157
- inputs: disabled handling (#16071) (ef6895a)
- label: do not animate float labels on initial load (#16036) (e644fc9)
- note: update note font size for MD (#16088) (6f2b9b0)
- picker: delay option animate until after options initialized (#16037) (a74e565)
- picker: fix iOS picker options that shouldn't be showing (#16055) (02ef52b)
- popover: update border radius to match MD (#16086) (9c733e9)
- popover: update the box shadow to match MD spec (#16089) (fdb7da9)
- radio: match MD sizing (#16087) (6723248)
- range: match MD spec (#16150) (b2f493f)
- reorder-group: event bubbles up (#16030) (ce80b24), closes #16010
- screenshot: update screenshot ci (#15969) (80b5c8c)
- searchbar: do not animate during initial load (#16147) (e94b522)
- tab-bar: align tab text to the center (#16130) (67eb7cf), closes #15273
- tabs: name prop is not longer used (6d11cc1)
- theming: update global css variable naming and default values (#16003) (b2021fd), closes #15989 #15559
- toggle: fix box-shadow overflow in toggle (#15955) (8a4dc74), closes #14626
- angular: fix ngModel accessor (fab8b60)
- color: edge currentColor bug (#16177) (fce30eb), closes #16168
- searchbar: fix crash on cancel event (#16181) (9c79d98), closes #16143
- tab-bar: safe-bottom area is applied correctly (#16179) (1532bd2), closes #16175
- tabs: use slot instead of placement (72f0a76)