Skip to content

Tunaweza/nativescript-radiobutton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NativeScript-RadioButton

npm npm

A NativeScript plugin for the native radiogroup and radiobutton widget.

Platform controls used:

Android iOS
Android RadioGroup NONE
Android RadioButton NONE

Installation

From your command prompt/terminal go to your app's root folder and execute:

tns plugin add nativescript-radiobutton

Usage

Demo App

If you want a quickstart, clone the repo, cd src, and execute the following commands:

npm install
npm run demo.android

Angular

Import to NgModule for use

import { RadioButtonModule } from 'nativescript-radiobutton/angular'

@NgModule({
    imports: [
        RadioButtonModule
    ]
})

Place this in your view.

<StackLayout>
    <RadioGroup [(value)]="dataBoundVariable">
        <RadioButton text="Selection 1"></RadioButton>
        <RadioButton text="Selection 2"></RadioButton>
        <RadioButton text="Selection 3"></RadioButton>
    </RadioGroup>
</StackLayout>

NativeScript-Vue

In your main.js register both RadioGroup and RadioButton elements

Vue.registerElement('RadioGroup', () => require('nativescript-radiobutton').RadioGroup)
Vue.registerElement('RadioButton', () => require('nativescript-radiobutton').RadioButton)

And in your template, use it

<RadioGroup
  @selected="onSelected">
  <RadioButton
    v-for="item in someList"
    :key="item.id"
    :text="item.text">
  </RadioButton>
</RadioGroup>

Supported Properties

###RadioButton

Android Example
enabled enabled="true | false"
text text="a string"
checked checked="true | false"

###RadioGroup

Android Returns
value the index of the radio button selected

Supported Events

###RadioButton

Android Example
enabled enabled="true | false"
text text="a string"
checked checked="true | false"

###RadioGroup

Android Type
value EventEmitter

About

A plugin for nativescript that exposes the radiogroup and radiobutton native view elements.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published