yfix.net
  • Home
  • Docs
  • Html
  • Slate
    • bootstrap
    • cyborg
    • slate
  • Overview
  • Install
  • Demos
  • Forms
  • Tables
  • HTML widgets
  • a
  • accordion
  • alert
  • badge
  • breadcrumbs
  • btn_active
  • button
  • button_box
  • button_radio_box
  • button_yes_no_box
  • carousel
  • check_box
  • chosen_box
  • collapse
  • complex_test
  • country
  • date_box
  • date_box2
  • date_picker
  • dd_table
  • div_box
  • dropdown
  • fa_icon_class
  • grid
  • html
  • icon
  • image_select_box
  • input
  • ip
  • jumbotron
  • li
  • list_box
  • list_group
  • map
  • map_view
  • media_objects
  • menu
  • modal
  • module_menu
  • multi_check_box
  • navbar
  • navlist
  • offcanvas
  • pagination
  • panel
  • phone_box
  • placeholder
  • progress_bar
  • radio_box
  • ratio
  • select2_box
  • select_box
  • simple_table
  • spinner
  • tabs
  • textarea
  • thumbnails
  • toast
  • tom_select_box
  • tooltip
  • tooltip_html
  • tree
  • ui_class
  • well
  • htmx
  • Misc
  • Plugins

carousel() html()

An image carousel with captions, indicators and arrows.

html()->carousel($data = [], $extra = [])

Options

OptionMeaning
$dataSlides: an image URL, or ['img', 'desc' (HTML caption), 'alt'].
idDefault carousel_<n>.
fade, interval, pause, ride, touch, wrap, keyboard, themeBootstrap 5 options of the carousel.

Example

First labelCaptions are HTML.

First label

Captions are HTML.

Second label

Second label

Third slide

Code

$slide = fn ($text, $color) => 'data:image/svg+xml,' . rawurlencode('<svg xmlns="http://www.w3.org/2000/svg" width="870" height="300"><rect width="870" height="300" fill="' . $color . '"/>'
    . '<text x="435" y="150" fill="#fff" font-family="sans-serif" font-size="40" text-anchor="middle">' . $text . '</text></svg>');
css('.carousel { max-width: 870px; }');
return html()->carousel([
    ['img' => $slide('First slide', '#337ab7'), 'desc' => '<h4>First label</h4><p>Captions are HTML.</p>'],
    ['img' => $slide('Second slide', '#5cb85c'), 'desc' => '<h4>Second label</h4>'],
    ['img' => $slide('Third slide', '#f0ad4e'), 'alt' => 'Third slide'],
    $slide('Fourth slide', '#5bc0de'),
    $slide('Fifth slide', '#d9534f'),
    $slide('Sixth slide', '#777777'),
]);

Notes

  • The demo draws inline SVG slides, so the page needs no network.

Bootstrap 3 and 5

Bootstrap 3 carousel (.item); Bootstrap 5 carousel-item with data-bs-* options.

See also: html/thumbnails, demo:html/bs5_options