Skip to content
COMPONENT / LAYOUT

Collapsible.

Bungkus satu penjelasan dalam disclosure.

PHP + native HTML/CSSNo build

Preview

Try this component

Small, understandable components. Native PHP, ready for the browser.

Usage

Bungkus satu penjelasan dalam disclosure. Set open true untuk kondisi awal terbuka.

  1. Gunakan layout DL yang sudah memuat CSS dan dl.js.
  2. Letakkan kode berikut di view PHP Anda.
  3. Ganti data contoh dengan nilai aplikasi. Teks di-escape otomatis.
PHP view
<?= component('collapsible', ['text' => 'Small, understandable components. Native PHP, ready for the browser.', 'label' => 'Try this component']) ?>

Examples

Initially open

Details

Konten sudah terbuka.

PHP view
<?= component('collapsible', ['label' => 'Details', 'text' => 'Konten sudah terbuka.', 'open' => true]) ?>

API reference

Props PHP yang didukung implementasi DL. Field di dalam array mengikuti bentuk pada kolom Type. Props yang tidak dicantumkan tidak menjadi bagian API komponen.

Collapsible props
PropType / valuesPanduan
textstringIsi teks biasa; HTML di-escape.
labelstringTeks label, pemicu, atau nama aksesibel komponen.
openboolDisclosure terbuka awal (default false).

Behavior & accessibility

Native details bekerja tanpa JavaScript dan dapat dioperasikan lewat keyboard.

Uji keyboard, fokus, dan pembaca layar pada halaman aplikasi Anda. Contoh ini tidak menggantikan audit aksesibilitas aplikasi secara menyeluruh.

Source & agent context

Source tersedia di views/components/collapsible.php. Edit template ini jika membutuhkan perilaku tambahan. API PHP DL berbeda dari API React sumber rujukan.

Terminal
php dl component collapsible

Component guide · JavaScript & events · Styling

Icons: Solar by 480 Design (CC BY 4.0) & Iconsax (MIT). PHP UI adapted from Coordiation. Logo: DesignLof.