new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

shadcn/ui · all subjects

advanced features

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Use Carousel API with setApi prop

Use the `setApi` prop to get an instance of the carousel API. Store it in state with `const [api, setApi] = React.useState<CarouselApi>()`. The API type is imported from @/components/ui/carousel as `CarouselApi`.

Carousel API methods

The carousel API instance has methods including `scrollSnapList()` which returns a list of scroll snap points, and `selectedScrollSnap()` which returns the index of the currently selected snap point (zero-based).

Listen to carousel events with API

Use the carousel API instance from `setApi` to listen to events. Call `api.on("eventName", callback)` to listen to events like "select".

Carousel event listener example

```tsx import { type CarouselApi } from "@/components/ui/carousel" export function Example() { const [api, setApi] = React.useState<CarouselApi>() React.useEffect(() => { if (!api) { return } api.on("select", () => { // Do something on select. }) }, [api]) return ( <Carousel setApi={setApi}> <CarouselContent> <CarouselItem>...</CarouselItem> <CarouselItem>...</CarouselItem> <CarouselItem>...</CarouselItem> </CarouselContent> </Carousel> ) } ```

Add carousel plugins

Use the `plugins` prop on Carousel to add plugins to the carousel. Pass an array of plugin instances.

Carousel autoplay plugin example

```ts import Autoplay from "embla-carousel-autoplay" export function Example() { return ( <Carousel plugins={[ Autoplay({ delay: 2000, }), ]} > // ... </Carousel> ) } ``` This example shows adding the Autoplay plugin with a 2000ms delay.

Give your agent this brain