Skip to content

Commit 649550a

Browse files
committed
feat: splitview docs
1 parent a7af1ab commit 649550a

File tree

5 files changed

+64
-16
lines changed

5 files changed

+64
-16
lines changed

content/ui/split-view.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,19 @@ It is intended to be used as the singular starting root view for the entire app.
2020
This component is ideal for iPadOS-style apps, admin-style layouts, or any experience where you need a master-detail flow plus an extra contextual pane or inspector.
2121
:::
2222

23-
## Example
23+
<Tabs>
24+
<Tab flavor="typescript">
2425

25-
### Declarative XML
26+
<<< @/../examples/typescript/src/ui/SplitView/template.xml#example
27+
28+
</Tab>
29+
<Tab flavor="angular">
30+
31+
<<< @/../examples/angular/src/ui/SplitView/component.html#example
32+
33+
</Tab>
34+
</Tabs>
2635

27-
```xml
28-
<SplitView
29-
displayMode="twoBesideSecondary"
30-
splitBehavior="tile"
31-
preferredPrimaryColumnWidthFraction="0.25"
32-
preferredSupplementaryColumnWidthFraction="0.33"
33-
preferredInspectorColumnWidthFraction="0.20">
34-
35-
<Frame splitRole="primary" defaultPage="pages/master" />
36-
<Frame splitRole="secondary" defaultPage="pages/detail" />
37-
<Frame splitRole="supplementary" defaultPage="pages/context" />
38-
<Frame splitRole="inspector" defaultPage="pages/inspector" />
39-
</SplitView>
40-
```
4136
This configures a 3–4 column layout (depending on OS support) and assigns each role to its own frame.
4237

4338
### Programmatic

examples/angular/src/app.routes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { ScrollViewComponent } from './ui/ScrollView/component'
1717
import { SearchBarComponent } from './ui/SearchBar/component'
1818
import { SegmentedBarComponent } from './ui/SegmentedBar/component'
1919
import { SliderComponent } from './ui/Slider/component'
20+
import { SplitViewComponent } from './ui/SplitView/component'
2021
import { SwitchComponent } from './ui/Switch/component'
2122
import { TabViewComponent } from './ui/TabView/component'
2223
import { TextFieldComponent } from './ui/TextField/component'
@@ -44,6 +45,9 @@ export const routes: Routes = [
4445
{ path: 'ui/SearchBar', component: SearchBarComponent },
4546
{ path: 'ui/SegmentedBar', component: SegmentedBarComponent },
4647
{ path: 'ui/Slider', component: SliderComponent },
48+
// must be root route to function properly
49+
// here for docs template examples only
50+
// { path: 'ui/SplitView', component: SplitViewComponent },
4751
{ path: 'ui/Switch', component: SwitchComponent },
4852
{ path: 'ui/TabView', component: TabViewComponent },
4953
{ path: 'ui/TextField', component: TextFieldComponent },
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!-- #region example -->
2+
<SplitView
3+
displayMode="twoBesideSecondary"
4+
splitBehavior="tile"
5+
preferredPrimaryColumnWidthFraction="0.22"
6+
preferredSupplementaryColumnWidthFraction="0.34"
7+
preferredInspectorColumnWidthFraction="0.19"
8+
(inspectorChange)="onInspectorChange($event)"
9+
navigationBarTintColor="blue"
10+
>
11+
<page-router-outlet
12+
name="primary"
13+
splitRole="primary"
14+
></page-router-outlet>
15+
16+
<page-router-outlet
17+
name="secondary"
18+
splitRole="secondary"
19+
></page-router-outlet>
20+
21+
<page-router-outlet
22+
name="supplementary"
23+
splitRole="supplementary"
24+
></page-router-outlet>
25+
26+
<page-router-outlet
27+
name="inspector"
28+
splitRole="inspector"
29+
></page-router-outlet>
30+
</SplitView>
31+
<!-- #endregion example -->
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component, NO_ERRORS_SCHEMA } from '@angular/core'
2+
import { NativeScriptCommonModule } from '@nativescript/angular';
3+
4+
@Component({
5+
selector: 'ns-split-view',
6+
templateUrl: './component.html',
7+
imports: [NativeScriptCommonModule],
8+
schemas: [NO_ERRORS_SCHEMA]
9+
})
10+
export class SplitViewComponent { }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- #region example -->
2+
<SplitView displayMode="twoBesideSecondary" splitBehavior="tile" preferredPrimaryColumnWidthFraction="0.25" preferredSupplementaryColumnWidthFraction="0.33" preferredInspectorColumnWidthFraction="0.20">
3+
<Frame splitRole="primary" defaultPage="pages/master" />
4+
<Frame splitRole="secondary" defaultPage="pages/detail" />
5+
<Frame splitRole="supplementary" defaultPage="pages/context" />
6+
<Frame splitRole="inspector" defaultPage="pages/inspector" />
7+
</SplitView>
8+
<!-- #endregion example -->

0 commit comments

Comments
 (0)