UPDATE-RATE

Die Test-Installation wird aktuell zwischen 8:00 und 18:00 Uhr stündlich zur vollen Stunde aktualisiert.

Alles neu macht der Mai

ILIAS 9 ist da! Alle Infos zu den Highlights der neuen Version gibt es hier!

Documentation

Kitchen Sink documentation of style: 'Delos' of skin: 'ILIAS'

Close

Description

Purpose
The close button triggers the closing of some collection displayed temporarily such as an overlay.
Composition
The close button is displayed without border.
Effect
Clicking the close button closes the enclosing collection.

Rules

Ordering
  1. The Close Button MUST always be positioned in the top right of a collection.
Accessibility
  1. The functionality of the close button MUST be indicated for screen readers by an aria-label.

Example 1: Base

<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Button\Close;
 
/**
 * Note that this example is rather artificial, since the close button is only used in other components
 * (see purpose). This examples just shows how one could render the button if implementing
 * such a component. Note that in some cases additional CSS would be needed for placing
 * the button properly by the surrounding component.
 */
function base()
{
    global $DIC;
    $f = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
 
    return $renderer->render($f->button()->close());
}
 

Example 2: Modal

<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Button\Close;
 
/**
 * This second example shows a scenario in which the Close Button is used in an overlay
 * as indicated in the purpose description. Note that in the Modal the Close Button
 * is properly placed in the top right corner.
 */
function modal()
{
    global $DIC;
    $factory = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
 
    $modal = $factory->modal()->roundtrip(
        'Close Button Demo',
        $factory->legacy('See the Close Button in the top right corner.')
    );
    $button1 = $factory->button()->standard('Show Close Button Demo', '#')
        ->withOnClick($modal->getShowSignal());
 
    return $renderer->render([$button1, $modal]);
}
 

Relations

Parents
  1. UIComponent
  2. Button