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

updated carousel docs. #1675

Merged
merged 39 commits into from
Nov 22, 2023
Merged
Changes from 11 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ab2a943
updating carousel docs.
siddhantrawal Nov 6, 2023
2faab58
moving props back to original place.
siddhantrawal Nov 6, 2023
6498fb9
Updated Carousel.DotsList text.
siddhantrawal Nov 6, 2023
0bded06
updated subcomponets text.
siddhantrawal Nov 6, 2023
44b5dd8
Merge branch 'siddhant/update_carousel_docs' of https://github.com/iT…
siddhantrawal Nov 6, 2023
9f2cff3
updated text.
siddhantrawal Nov 7, 2023
e141ca8
Fixed comments.
siddhantrawal Nov 7, 2023
57033cd
Updated controlled state text.
siddhantrawal Nov 8, 2023
09f001d
Fixed comment related to adding info about order.
siddhantrawal Nov 8, 2023
b33f1ad
Merge branch 'siddhant/update_carousel_docs' of https://github.com/iT…
siddhantrawal Nov 8, 2023
c805eaf
Added important paragraph.
siddhantrawal Nov 8, 2023
65d864d
Updated Carousel component text.
siddhantrawal Nov 9, 2023
66c7052
Updated and rearranged text related to comments,
siddhantrawal Nov 13, 2023
8926ddd
Merge branch 'siddhant/update_carousel_docs' of https://github.com/iT…
siddhantrawal Nov 13, 2023
6f8948f
Merge branch 'main' into siddhant/update_carousel_docs
siddhantrawal Nov 15, 2023
bec7c1f
Merge branch 'main' into siddhant/update_carousel_docs
siddhantrawal Nov 16, 2023
03dfeb4
Updated Carousel.DotsList text.
siddhantrawal Nov 16, 2023
b53ce01
updated carousel main text.
siddhantrawal Nov 16, 2023
ef86b34
updated subcomponents text.
siddhantrawal Nov 16, 2023
524a65d
Moved carousel props to bottom?
siddhantrawal Nov 16, 2023
eb6fc67
Merge branch 'main' into siddhant/update_carousel_docs
siddhantrawal Nov 17, 2023
940ffe8
Merge branch 'main' into siddhant/update_carousel_docs
siddhantrawal Nov 20, 2023
8a7bf2c
Update accessibility text.
siddhantrawal Nov 20, 2023
dc75acc
Updating subcomponents text.
siddhantrawal Nov 20, 2023
46ce266
removed onlyDots example and heading.
siddhantrawal Nov 20, 2023
0a3ec6b
Added static example.
siddhantrawal Nov 20, 2023
1bd6e58
removed props heading & shifted accessibility section.
siddhantrawal Nov 20, 2023
aff0b29
removed placeholder import.
siddhantrawal Nov 21, 2023
4d0026c
Updated fragment links.
siddhantrawal Nov 21, 2023
8d6d4fb
replacing propspath variable to inline.
siddhantrawal Nov 21, 2023
b907ae6
moving text under carousel and usage sub heading,
siddhantrawal Nov 21, 2023
d364d81
text moved related to comments.
siddhantrawal Nov 21, 2023
80207ef
Updated Carousel.DotsList Text.
siddhantrawal Nov 21, 2023
10a70f4
Added sub heading for previous and next button.
siddhantrawal Nov 21, 2023
44154fb
Added fragment link for Carousel.Slide.
siddhantrawal Nov 21, 2023
be6e036
Added fragment link for Carousel.Dot
siddhantrawal Nov 21, 2023
230c304
Updated link for navigation heading.
siddhantrawal Nov 21, 2023
73bc974
Updated Carousel.Dot text.
siddhantrawal Nov 21, 2023
5e5a0b6
updated jsdocs.
siddhantrawal Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions apps/website/src/pages/docs/carousel.mdx
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,40 @@ import * as AllExamples from 'examples';

<p>{frontmatter.description}</p>

<Placeholder componentPageName='core--carousel' />

<LiveExample src='Carousel.main.tsx'>
<AllExamples.CarouselMainExample client:load />
</LiveExample>

The Carousel component consists of a set of slides, normally displayed one at a time. A navigation section is
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
located below the slides, consisting of "dots" and "previous"/"next" buttons, used for changing slides.
located below the slides, consisting of "dots" ([Carousel.DotsList](#dots-list)) and "previous"/"next" ([Carousel.Navigation](#navigation)) buttons, used for changing slides.
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

The currently shown slide can also be changed using the left/right arrow keys or by dragging on a touch device.

## Usage
r100-stack marked this conversation as resolved.
Show resolved Hide resolved
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

Carousels can be controlled externally by using the properties `activeSlideIndex` and `onSlideChange`.
### Controlled State

By default, the carousel maintains its own state. But it can also be controlled externally using `activeSlideIndex` and `onSlideChange`.

<LiveExample src='Carousel.controlled.tsx'>
<AllExamples.CarouselControlledExample client:load />
</LiveExample>

The subcomponents can be used outside of Carousel. The following example shows how `Carousel.DotsList` can be used without the `Carousel` component. Clicking on the right half of the slide will advance the carousel to the next slide, whereas clicking on the left half will go to the previous slide.
### Only Dots

`Carousel.DotsList` can be used without the `Carousel` component. Here is an example to demonstrate this where clicking on the right/left half of the slide will go one slide forward/backward.

<LiveExample src='Carousel.onlyDots.tsx'>
<AllExamples.CarouselOnlyDotsExample client:load />
</LiveExample>
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

## Props
r100-stack marked this conversation as resolved.
Show resolved Hide resolved
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

Properties table is to be defined.

<PropsTable path={frontmatter.propsPath} />
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

## Subcomponents

This component uses a composition approach so it should be used with the provided subcomponents.
This component uses a composition approach, similar to most of the other components.
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

### Slider
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -61,14 +61,18 @@ This component uses a composition approach so it should be used with the provide

### Navigation

The `Carousel.Navigation` component by default consists of the `PreviousButton` and `NextButton` shown on the left and right, and the `Carousel.DotsList` component shown in the middle. `children` can be specified to override what is shown in this navigation section.
The `Carousel.Navigation` component by default consists of the `PreviousButton` and `NextButton` shown on the left and right and the `Carousel.DotsList` component shown in the middle. `children` can be specified to override what is shown in this navigation section.
siddhantrawal marked this conversation as resolved.
Show resolved Hide resolved

**Important**: The navigation section must always be present before the slides in DOM order.

<PropsTable path={'@itwin/itwinui-react/esm/core/Carousel/CarouselNavigation.d.ts'} />

### Dots List

The `Carousel.DotsList` component shows a list of `Carousel.Dot` components which can be used to choose a specific slide. If used as a descendant of `Carousel`, then this component does not need any props or `children`. The props can be specified if this component is being used outside `Carousel`. `children` can be specified to override the individual dots that are shown.

**Important**: The component must always be present before the slides in DOM order.
mayank99 marked this conversation as resolved.
Show resolved Hide resolved

<PropsTable path={'@itwin/itwinui-react/esm/core/Carousel/CarouselDotsList.d.ts'} />

### Dot
Expand Down
Loading