Welcome to the svelte native tutorial
In this tutorial we will cover tags and some useful scripts of svelte native and native script overalll, the Official tutorial also covers everything about native script. The svelte native has different tags compared to normal html tags and also the text input works differently in it, lets find out
Lets go through the tags!
Svelte Native has variety of tags that serve different purposes and have different functionality.
1
actionBar
2
actionItem
3
activityIndicator
4
button
5
datePicker
6
dockLayout
7
flexboxLayout
8
frame
9
gridLayout
10
htmlView
11
image
12
listPicker
13
listView
14
navigationButton
15
label
16
progress
17
proxyViewContainer
18
rootLayout
19
scrollView
20
searchBar
21
segmentedBar
22
slider
23
formattedString
24
stackLayout
25
switch
26
tabView
27
tabViewItem
28
textField
29
textView
30
timePicker
31
webView
32
wrapLayout
Please read this before continuing!
When running the app in preview you can press R key to restart the development process as sometimes the changes are stuck and can't be seen in the mobile, also the following templates that are provided should be nested in <frame><page> {Your code/tags here!} </page></frame>, remember not to nest two <page></page> as it may result in error lets see and example :
<frame>
<page>
<Your rest of the tags>
</page>
</frame>
1. actionBar
Represents the apps top bar.
copy 📎
<page>
<actionBar title="My App"/>
</page>
2. actionItem
A button in the action bar
copy 📎
<page>
<actionBar title="My App">
<actionItem text="Info" />
</actionBar>
</page>
3. activityIndicator
Shows a spinning loader.
copy 📎
<page>
<activityIndicator busy={true} />
</page>
4. button
A tappable button.
copy 📎
<page>
<button text="Click Me" />
</page>
5. datePicker
A date selection component.
copy 📎
<page>
<datePicker />
</page>
6. dockLayout
Layout where children can be docked to a specific side.
copy 📎
<page>
<dockLayout>
<label dock="top" text="Top Dock" />
<label dock="bottom" text="Bottom Dock" />
</dockLayout>
</page>
7. flexboxLayout
A layout based on css flexbox
copy 📎
<page>
<flexboxLayout>
<label text="Item 1" />
<label text="Item 2" />
</flexboxLayout>
</page>
8. frame
The main navigation container.
copy 📎
<frame>
<page>
<label text="Home Page" />
</page>
</frame>
9. gridLayout
Grid-based layout with rows and columns.
copy 📎
<page>
<gridLayout rows="auto, auto" columns="auto, auto">
<label row="0" col="0" text="Row 0, Col 0" />
<label row="0" col="1" text="Row 0, Col 1" />
<label row="1" col="0" text="Row 1, Col 0" />
<label row="1" col="1" text="Row 1, Col 1" />
</gridLayout>
</page>
10. htmlView
Displays HTML content.
copy 📎
<page>
<htmlView html="<h1>Hello World</h1><p>This is HTML content.</p>" />
</page>
11. image
Displays an image.
copy 📎
<page>
<image src="~/images/logo.png" />
</page>
12. listPicker
A dropdown list.
copy 📎
<page>
<listPicker items={['Item 1', 'Item 2', 'Item 3']} />
</page>
13. listView
A scrollable list of items.
copy 📎
<page>
<listView items={['Item 1', 'Item 2', 'Item 3']}>
{#each items as item}
<label text={item} />
{/each}
</listView>
</page>
14. navigationButton
A button to navigate back.
copy 📎
<page>
<actionBar title="Page Title">
<navigationButton text="Back" />
</actionBar>
</page>
15. label
a label that represents some text.
copy 📎
<page>
<label text="Hello, World!" />
</page>
16. progress
A progress bar.
copy 📎
<page>
<progress value="50" maxValue="100" />
</page>
17. proxyViewContainer
A container that proxies its children.
copy 📎
<page>
<proxyViewContainer>
<label text="Proxy View" />
</proxyViewContainer>
</page>
18. rootLayout
The root layout of the app.
copy 📎
<rootLayout>
<label text="Root Layout Content" />
</rootLayout>
19. scrollView
A scrollable container.
copy 📎
<page>
<scrollView>
<label text="Scrollable content" />
</scrollView>
</page>
20. searchBar
A search input
copy 📎
<page>
<searchBar hint="Search here..." />
</page>
21. segmentedBar
A segment control and segment item.
copy 📎
<page>
<segmentedBar>
<segmentedBarItem title="Tab 1" />
<segmentedBarItem title="Tab 2" />
</segmentedBar>
</page>
22. slider
A control for selecting value from a given range.
copy 📎
<page>
<slider minValue="0" maxValue="100" value="50" />
</page>
23. formattedString
Enables rich text formatting.
copy 📎
<page>
<label>
<formattedString>
<span text="Normal " />
<span text="Bold" fontWeight="bold" />
</formattedString>
</label>
</page>
24. stackLayout
A layout where children are stacked vertically.
copy 📎
<page>
<stackLayout>
<label text="Item 1" />
<label text="Item 2" />
</stackLayout>
</page>
25. switch
A toggle switch.
copy 📎
<page>
<switch checked={true} />
</page>
26. tabView
A container with multiple tabs.
copy 📎
<page>
<tabView>
<tabViewItem title="Tab 1">
<label text="Content for Tab 1" />
</tabViewItem>
<tabViewItem title="Tab 2">
<label text="Content for Tab 2" />
</tabViewItem>
</tabView>
</page>
27. tabViewItem
items for tab view container
copy 📎
<page>
<tabView>
<tabViewItem title="Tab 1">
<label text="Content for Tab 1" />
</tabViewItem>
</tabView>
</page>
28. textField
A single-line text input field.
copy 📎
<page>
<textField hint="Enter text here" />
</page>
29. textView
multi-line text input field.
copy 📎
<page>
<textView hint="Enter long text here" />
</page>
30. timePicker
A time selection component.
copy 📎
<page>
<timePicker />
</page>
31. webView
A component to display web content.
copy 📎
<page>
<webView src="https://www.example.com" />
</page>
32. wrapLayout
A layout that wraps its children in a new row or column when they exceed the available space.
copy 📎
<page>
<wrapLayout>
<label text="Item 1" />
<label text="Item 2" />
<label text="Item 3" />
<label text="Item 4" />
</wrapLayout>
</page>
Looking for support?
Svelte JS
Svelte Native
Tanishq Dhote