Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose canScrollPrev and canScrollNext with carousel render prop #6904

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sadmann7
Copy link

@sadmann7 sadmann7 commented Mar 10, 2025

this pr add the functionality to conditionally render navigation button without calling the useCarousel hook externally.

<Carousel>
  {({ canScrollNext, canScrollPrev }) => (
    <>
      <CarouselContent>
        <CarouselItem>Slide 1</CarouselItem>
        <CarouselItem>Slide 2</CarouselItem>
      </CarouselContent>
      {canScrollPrev && <CarouselPrevious />}
      {canScrollNext && <CarouselNext />}
    </>
  )}
</Carousel>

Copy link

vercel bot commented Mar 10, 2025

@sadmann7 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@sadmann7 sadmann7 changed the title feat: expose canScrollPrev and canScrollNext with carousel render prop feat: expose canScrollPrev and canScrollNext with carousel children prop Mar 10, 2025
@sadmann7 sadmann7 changed the title feat: expose canScrollPrev and canScrollNext with carousel children prop feat: expose canScrollPrev and canScrollNext with carousel render prop Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant