Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Auto-advance with a pause

Use auto-advance only with a pause button in view, and prefer no autoplay for anything people must read in full.

Testimonials
Five customer stories advancing every five seconds, two in view from the medium breakpoint and three from the large one.
Show code
<app-carousel label="Customer stories" autoplay="5000" per-view-md="2" per-view-lg="3">
    <app-carousel-slide>…</app-carousel-slide>
</app-carousel>

Looping buttons

Turn on loop for a ring of slides, so the buttons wrap from the last slide back to the first.

Three stories
Three customer stories with loop on.
Show code
<app-carousel label="Customer stories" loop="true">
    <app-carousel-slide>…</app-carousel-slide>
</app-carousel>

Every option

Every value of every prop, one cell each.

label: text

label="Team news" (accessible name, not drawn)

children: slides

app-carousel-slide: each child tag is one slide

autoplay: none or a number

autoplay omitted (default)
autoplay="5000"

loop: true or false

loop="false" (default)
loop="true"

perView: 1 to 3

per-view="1" (default)
per-view="2"
per-view="3"

perViewMd: 1 to 4

per-view-md="1"
per-view-md="2"
per-view-md="3"
per-view-md="4"

perViewLg: 1 to 5

per-view-lg="1"
per-view-lg="2"
per-view-lg="3"
per-view-lg="4"
per-view-lg="5"

arrows: true or false

arrows="true" (default)
arrows="false"

dots: true or false

dots="true" (default)
dots="false"

previousLabel: text

previous-label="Back" (accessible name, not drawn)

nextLabel: text

next-label="Forward" (accessible name, not drawn)

dotLabel: text

dot-label="Show slide" (accessible name, not drawn)

pauseLabel: text

pause-label="Hold" (shown with autoplay)

playLabel: text

play-label="Resume" (shown after Pause)

className: text

class="mb-3"

style: object

style="opacity: 0.6"

Guidance

What to do, and what to avoid.

Use it when

  • A handful of equal slides: testimonials, featured items.
  • Content that is fine to read a slide at a time.

Reach for something else when

  • Steps a person must complete in order. → AppWizard
  • A long list people scan and filter. → AppDataTable

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

React, generated from the controls
<AppCarousel label="Customer stories" perView={1} perViewMd={2} perViewLg={3}>
  {stories}
</AppCarousel>
Razor, the same props
<app-carousel label="Customer stories" per-view="1" per-view-md="2" per-view-lg="3">…</app-carousel>

13 props. The 5 most used come first.

Used on most screens 5 props

PropTypeDefaultDescription
labeldefault - string - What the slides are ("Customer stories"): the carousel's accessible name.
autoplaydefault - int - Milliseconds between automatic steps (5000 is typical). Omit for none.
loopdefault false bool false The previous and next buttons wrap around at the ends.
per-viewdefault 1 int 1 Slides in view on a phone.
arrowsdefault true bool true Show the previous and next buttons.

Less common 8 props

PropTypeDefaultDescription
per-view-mddefault - int - Slides in view from the md breakpoint. Defaults to per-view.
per-view-lgdefault - int - Slides in view from the lg breakpoint. Defaults to per-view-md.
dotsdefault true bool true Show the page dots.
previous-labeldefault Previous slide string Previous slide The previous button's name.
next-labeldefault Next slide string Next slide The next button's name.
dot-labeldefault Go to slide string Go to slide The words before the slide number in each dot's name.
pause-labeldefault Pause string Pause The pause button's text and name while playing.
play-labeldefault Play string Play The pause button's text and name while paused.

Screen reader

3 notes
  • The carousel is a named region with the role description carousel; the label names it.
  • Each slide is a group described as a slide; the slide row takes keyboard focus and moves with the arrow, Home and End keys; the previous and next buttons are named by previousLabel and nextLabel.
  • The pause button is named by pauseLabel while playing and by playLabel while paused; each page dot is named by dotLabel and its slide number.