Skip to content

Commit efdf890

Browse files
feat(segment): prepare segment expand style (#36)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b798f3a commit efdf890

File tree

9 files changed

+98
-64
lines changed

9 files changed

+98
-64
lines changed

README.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ To customize the library's default styles to match your design, several CSS vari
5555

5656
https://github.com/rdlabo-team/ionic-theme-ios26/blob/main/src/default-variables.scss
5757

58+
59+
### Additional Customization
60+
61+
To achieve higher fidelity to iOS26 design, you can implement additional customizations provided by this library. For more details, please visit:
62+
63+
https://ionic-theme-ios26.netlify.app/main/docs
64+
65+
5866
### Liquid Glass Mixin
5967

6068
Import the SCSS files from the main package to use the liquid glass mixin.
@@ -67,6 +75,7 @@ ion-textarea label.textarea-wrapper {
6775
}
6876
```
6977

78+
7079
## Features
7180

7281
### `.ios26-disabled` Class
@@ -124,21 +133,6 @@ You can see the difference in the following video. The first example shows `ion-
124133

125134
This is a known issue that has been shared with the Ionic team. We will update this library accordingly once Ionic Core addresses it.
126135

127-
### Brightness Colors for Better Visual Quality
128-
129-
In iOS26, the Submit button uses text and border colors slightly brighter than the base color.
130-
This effect can't be achieved by simply transforming existing palette colors, so separate colors are needed. You don't have to define them—the design will still work—but adding them can give more refined color results.
131-
132-
```diff
133-
:root {
134-
+ --ion-color-primary-brightness: #96FEFF; /* example color */
135-
+ --ion-color-secondary-brightness: [your brightness color];
136-
+ --ion-color-tertiary-brightness: [your brightness color];
137-
+ --ion-color-success-brightness: [your brightness color];
138-
+ --ion-color-warning-brightness: [your brightness color];
139-
+ --ion-color-danger-brightness: [your brightness color];
140-
}
141-
```
142136

143137
## Migration Support
144138

3.49 KB
Loading
2.54 KB
Loading
3.47 KB
Loading

demo/src/app/docs/docs-page.component.html

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,15 @@
1414
<ion-title size="large">Docs</ion-title>
1515
</ion-toolbar>
1616
</ion-header>
17-
<section class="ion-padding-start ion-padding-end">
17+
<section class="ion-padding-start ion-padding-end ion-padding-bottom">
1818
<p>This is a demo of the iOS26 theme for Ionic Framework. Just import the CSS and start using it immediately.</p>
1919
<code class="code-block">% npm install &#64;rdlabo/ionic-theme-ios26 --save</code>
2020
<p>For detailed usage instructions, please refer to the README in the GitHub repository.</p>
21-
<ion-button color="dark" href="https://github.com/rdlabo-team/ionic-theme-ios26">
22-
<ion-icon name="logo-github" slot="start"></ion-icon>
23-
GitHub
24-
</ion-button>
2521
</section>
2622

2723
<ion-list [inset]="true">
2824
<ion-list-header><ion-label>Special Coding</ion-label><ion-note>Mode more iOS26</ion-note></ion-list-header>
29-
<ion-item-group>
25+
<ion-item-group class="ion-margin-bottom">
3026
<ion-item>
3127
<div>
3228
<h3><code>ion-button[fill=solid][type=submit]</code></h3>
@@ -43,5 +39,23 @@ <h3><code>ion-button[fill=solid][type=submit]</code></h3>
4339
</div>
4440
</ion-item>
4541
</ion-item-group>
42+
43+
<ion-item-group>
44+
<ion-item>
45+
<div class="ion-padding-bottom">
46+
<h3><code>ion-segment.segment-expand</code></h3>
47+
<p>To make segments span the full width, you need to apply a special class.</p>
48+
<code class="code-block ion-margin-bottom">&lt;ion-segment class="segment-expand"&gt;&lt;/ion-segment&gt;</code>
49+
<ion-segment value="default" class="segment-expand">
50+
<ion-segment-button value="default">
51+
<ion-label>New</ion-label>
52+
</ion-segment-button>
53+
<ion-segment-button value="segment">
54+
<ion-label>Replied</ion-label>
55+
</ion-segment-button>
56+
</ion-segment>
57+
</div>
58+
</ion-item>
59+
</ion-item-group>
4660
</ion-list>
4761
</ion-content>

demo/src/app/docs/docs-page.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import {
88
IonHeader,
99
IonIcon,
1010
IonItem,
11-
IonItemGroup,
1211
IonLabel,
1312
IonList,
13+
IonSegment,
14+
IonSegmentButton,
15+
IonItemGroup,
1416
IonListHeader,
1517
IonNote,
1618
IonTitle,
@@ -34,6 +36,9 @@ import {
3436
IonButtons,
3537
IonList,
3638
IonItem,
39+
IonSegment,
40+
IonLabel,
41+
IonSegmentButton,
3742
IonListHeader,
3843
IonLabel,
3944
IonNote,

demo/src/app/index/pages/segment/segment.page.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
</ion-segment>
1313
<ion-back-button slot="end" defaultHref="/main/index" style="visibility: hidden"></ion-back-button>
1414
</ion-toolbar>
15+
<ion-toolbar>
16+
<ion-segment value="default" class="segment-expand">
17+
<ion-segment-button value="default">
18+
<ion-label>New</ion-label>
19+
</ion-segment-button>
20+
<ion-segment-button value="segment">
21+
<ion-label>Replied</ion-label>
22+
</ion-segment-button>
23+
</ion-segment>
24+
</ion-toolbar>
1525
</ion-header>
1626

1727
<ion-content [fullscreen]="true" color="light">

src/components/ion-segment.scss

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,63 @@
11
@use '../utils/api';
22

3-
ion-toolbar.ios:not(.ios26-disabled) {
4-
ion-segment {
5-
@include api.glass-background;
6-
min-height: 48px;
7-
border-radius: 25px;
8-
9-
transition: transform var(--ios26-activated-transition-duration) ease-out;
10-
will-change: transform;
11-
12-
&.in-toolbar-color:not(.in-segment-color) {
13-
ion-segment-button:not(.segment-button-checked)::part(native) {
14-
color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 1) !important;
15-
}
3+
ion-segment.ios:not(.ios26-disabled) {
4+
@include api.glass-background;
5+
min-height: 48px;
6+
border-radius: 25px;
7+
8+
&.segment-expand {
9+
min-height: 24px;
10+
width: calc(100% - var(--ion-safe-area-left, 0) - var(--ion-safe-area-left, 0) - 24px);
11+
12+
&.segment-activated {
13+
transform: scale(1);
1614
}
1715

1816
ion-segment-button {
19-
--border-width: 0;
20-
--ion-color-base: var(--ion-text-color, #000);
21-
--padding-start: 8px;
22-
--padding-end: 8px;
23-
min-width: 60px;
24-
margin: 3px 2px;
25-
font-size: 14.5px;
17+
min-height: 24px;
18+
}
19+
}
2620

27-
&::part(indicator-background) {
28-
border-radius: 25px;
29-
box-shadow: none;
30-
transition: background 0.2s ease;
31-
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.06);
32-
}
21+
transition: transform var(--ios26-activated-transition-duration) ease-out;
22+
will-change: transform;
23+
24+
&.in-toolbar-color:not(.in-segment-color) {
25+
ion-segment-button:not(.segment-button-checked)::part(native) {
26+
color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 1) !important;
3327
}
28+
}
3429

35-
&.segment-activated {
36-
transform: scale(1.1);
37-
38-
ion-segment-button {
39-
transition: transform 100ms ease-out;
40-
&.segment-button-checked::part(native) {
41-
transform: scale(1.08);
42-
}
43-
&::part(indicator-background) {
44-
position: relative;
45-
z-index: 1;
46-
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0);
47-
transform: scale(1.1);
48-
transform-origin: center center;
49-
}
30+
ion-segment-button {
31+
--border-width: 0;
32+
--ion-color-base: var(--ion-text-color, #000);
33+
--padding-start: 8px;
34+
--padding-end: 8px;
35+
min-width: 60px;
36+
margin: 3px 2px;
37+
font-size: 14.5px;
38+
39+
&::part(indicator-background) {
40+
border-radius: 25px;
41+
box-shadow: none;
42+
transition: background 0.2s ease;
43+
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.06);
44+
}
45+
}
46+
47+
&.segment-activated {
48+
transform: scale(1.1);
49+
50+
ion-segment-button {
51+
transition: transform 100ms ease-out;
52+
&.segment-button-checked::part(native) {
53+
transform: scale(1.08);
54+
}
55+
&::part(indicator-background) {
56+
position: relative;
57+
z-index: 1;
58+
background: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0);
59+
transform: scale(1.1);
60+
transform-origin: center center;
5061
}
5162
}
5263
}

src/components/ion-toolbar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ion-header.ios.header-collapse-condense:not(.ios26-disabled) ion-toolbar:not(.io
2121
padding-top: 0;
2222
}
2323

24-
ion-toolbar.ios:not(.toolbar-title-large):not(.ios26-disabled) {
24+
ion-toolbar.ios:not(.toolbar-title-large):not(.ios26-disabled):not(:has(ion-segment.segment-expand)) {
2525
--min-height: 68px;
2626
}
2727

0 commit comments

Comments
 (0)