Skip to content

ElecTreeFrying/nativescript-angular-html-snippets

Repository files navigation

Nativescript: Angular HTML Snippets (vscode extension)

Updated for Nativescript v6.4.0 and Angular v9.0.0 release

This extension adds all Nativescript UI Components, Layouts and Gestures snippets in your HTML.

Features

  • Default syntax (Plain Nativescript tag)
  • Property syntax (Includes all element properties)
  • Complete syntax (Includes all element properties, events and documentation)
  • Layout snippets
  • Gesture snippets
  • System Icon snippets

For more examples and demo, see here.

Syntax

SuffixDescriptionOutput
-propproperty+ all element properties
-compcomplete+ all element properties and events
-snippet-[number]layout snippetLayout snippets available in site docs

Usage

snippetentered by useroutputdescription
defaultns-buttonnsbutt<Button></Button>Plain tag
property (prop)ns-button-propnsbutprwith *props+ All properties
complete (comp)ns-button-compnsbu-cwith *props, *events, *docs+ All properties, events and API docs
layout snippetsns-dock-layout-snippet-2nsdocnip2see belowSample snippets from site docs.
gesturesns-tapnstap(tap)=""Gesture Snippets
setting iconns-icon-stopnsicost14Setting Icon snippets

In Action: ns-dock-layout-snippet-2

<DockLayout width="210" height="210" backgroundColor="lightgray" stretchLastChild="true">
  <Label text="left" dock="left" backgroundColor="red"></Label>
  <Label text="top" dock="top" backgroundColor="green"></Label>
  <Label text="right" dock="right" backgroundColor="blue"></Label>
  <Label text="bottom" dock="bottom" backgroundColor="yellow"></Label>
</DockLayout>

In Action: ns-button

Default output

<Button></Button>

Property output

<Button text=""></Button>

Complete output

<Button
  text="string"
  (tap)=""
  (loaded)=""
  (unloaded)=""
  (layoutChanged)="">
</Button>
<!--
Properties
NAME	TYPE	  DESCRIPTION
text	string	Gets or sets the label of the button.

Events
NAME	        DESCRIPTION
tap	          Emitted when the button is tapped.
loaded	      Emitted when the view is loaded.
unloaded	    Emitted when the view is unloaded.
layoutChanged	Emitted when the layout bounds of a view changes due to layout processing.
 -->

Demo

HTML snippet ns-text-field in action; default, property (prop) and complete (comp) syntax demo.

nativescript-angular-html-snippet-demo

Snippets

For complete references examples and demo, see here.

User Interface > Layouts

  • ns-absolute-layout
  • ns-dock-layout
  • ns-grid-layout
  • ns-stack-layout
  • ns-wrap-layout
  • ns-flexbox-layout

User Interface > Components

  • ns-actionbar
  • ns-actionbarextension
  • ns-actionitem
  • ns-navigationbutton
  • ns-activityindicator
  • ns-button
  • ns-datepicker
  • ns-formattedstring
  • ns-htmlview
  • ns-image
  • ns-label
  • ns-listpicker
  • ns-listview
  • ns-progress
  • ns-scroll-view
  • ns-search-bar
  • ns-segmented-bar
  • ns-segmented-bar-item
  • ns-slider
  • ns-switch
  • ns-bottom-navigation
  • ns-tab-strip
  • ns-tab-strip-item
  • ns-tab-content-item
  • ns-tabs
  • ns-tab-view
  • ns-tab-view-item
  • ns-text-field
  • ns-text-view
  • ns-time-picker
  • ns-web-view

Gestures

SnippetOutput
ns-tap(tap)=""
ns-doubleTap(doubleTap)=""
ns-longPress(longPress)=""
ns-swipe(swipe)=""
ns-pan(pan)=""
ns-pinch(pinch)=""
ns-rotation(rotation)=""
ns-touch(touch)=""

Setting Icons

SnippetOutput
ns-icon-action9
ns-icon-undo21

List

ICONVALUEICONVALUE
Done0Search12
Cancel1Refresh13
Edit2Stop14
Save3Camera15
Add4Trash16
FlexibleSpace5Play17
FixedSpace6Pause18
Compose7Rewind19
Reply8FastForward20
Action9Undo21
Organize10Redo22
Bookmarks11PageCurl23

Reference: https://docs.nativescript.org/angular/ui/action-bar#setting-icons

Installation

  1. Install VS Code v1.42.0 or higher
  2. Launch Visual Studio Code
  3. Enter command Ctrl+Shift+P (Windows, Linux) or Cmd+Shift+P (OSX)
  4. Select → Extensions: Install Extensions.
  5. Choose Nativescript: Angular HTML Snippets by ElecTreeFrying
  6. Reload Visual Studio Code

Changelog

See CHANGELOG for more information.

Contributing

Support

Donate by Bitcoin (BTC)

bc1q9hjnxk67c9y6tsyp8jde43xg9hacf0kgdxq6jsxl47666d3hk8aqunv0xr

donate-by-bitcoin

Donate by Mining

Mining address (NiceHash)
3GJoX9cKs7eUHr6n5LcwNYEkSoD6mEqb1r

Related

More extensions of mine.

License

MIT