Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 811 Bytes

File metadata and controls

25 lines (17 loc) · 811 Bytes

Use

  1. useCarouse

Provides you with access to Carousel inside Base.preset.ts for managing or reading activeIndex, length (for pagination), and safly setting activeIndex via MainButton or BackButton.

Usage

Important

Ensure that you call this function within one of the 'children' of the Base.preset component or the component that defines the accessor for the CAROUSEL_ACCESSOR_TOKEN. Otherwise, the function will return null

<script setup lang="ts">
import { useCarousel } from '@tok/generation/use/carousel';

const carousel = useCarousel();

carousel.next();
carousel.back();
carousel.set(1);

const length = carousel.length.value;
const index = carousel.index.value;
</script>