Home

Awesome

This plugin is now maintained by the fine devs at NStudio. You can find the new repo here: https://github.com/nstudio/nativescript-plugins/tree/main/packages/nativescript-carousel


npm npm

NativeScript Carousel

A simple carousel component for NativeScript.

PlatformSupportedVersionNativeView
iOSYesiOS 8.1+DKCarouselView
AndroidYesAPI 15+ViewPager with PageIndicatorView

Installation

NativeScript 7+:

ns plugin add nativescript-carousel

NativeScript less than NS7:

tns plugin add nativescript-carousel@6.1.1

Limitations

Usage

Check out the demos included in this repo for instructions on how to use the Carousel with your choice of framework:

Vanilla TS demo

Angular demo

Vue demo

Attributes - Common

Assign a data-array to generate the slides and apply the bindingContext. If items is populated then you must use the template-option.

Defines the view template for each slide-view to be generated.

Sets/Gets the active page by index

Shows or hides the page-indicator

Sets the active indicator color. Default is semi-transparent white. Use hex or color-name.

Sets the color of unselected indicators

By default the indicator is centered at the bottom. You can use points (x,y) to move the indicator. E.g. indicatorOffset="100,100"

Attributes - iOS specific

If true last slide will wrap back to first and visa versa

If set to 'true' scrolling will bounce at the first/last page (non-infinite). Default is 'false'.

Defines the interval in seconds to wait before the next slide is shown. Default is 0 (off).

Enables/Disables user scroll on the Carousel.

Returns the DKCarouselView object.

Attributes - Android specific

Returns the ViewPager object.

Sets the pager-indicator animation type. Choose between: color, slide, scale, worm, thin_worm, fill, drop or none. Default is none.

Sets the pager-indicator animation duration in milliseconds. Default is 500.

Sets the pager-indicator alignment. Choose between top or bottom. Default is bottom.

Sets the pager-indicator dot radius.

Sets the pager-indicator dot padding.

Set the indicator count which will change the underlying Android data adapter. See issue #5 discussion

Demo

iOSAndroid
iOSAndroid

Indicator animations (Android only!)

NONECOLORSCALESLIDE
anim_noneanim_coloranim_scaleanim_slide
WORMTHIN_WORMFILLDROPSWAP
anim_wormanim_thin_wormanim_fillanim_dropanim_swap

Changelog

7.0.1

7.0.0

6.1.0

6.0.0

4.2.5

4.2.1

4.2.0

4.1.0

4.0.2

4.0.0

3.1.1

3.1.0

3.0.2

3.0.1

3.0.0

2.4.2

2.4.1

2.4.0

2.3.1

2.3.0

2.2.0

2.1.2

2.1.1

2.1.0

1.1.0

1.0.0

Author

Collaborators

Contributing

I will accept pull requests that improve this and assign credit.