İçeriğe geç

Örnekler

Komut menüsü

Komut paletinin aslına sadık biçimde yeniden oluşturulmuş hâli: bir iletişim kutusu odağı, açılır ve filtrelenmiş listesi girişin altında görünen bir birleşik giriş kutusuna aktarır; liste giriş satırlarının içinde açılmaz.

Önizleme

or press Cmd K
HTML
<bs:bsui-stack direction="row" gap="2" align="center">
  <bs:bsui-dialog>
    <bs:bsui-dialog-trigger trigger_label="Search documentation" trigger_variant="outline" />
    <bs:bsui-dialog-backdrop />
    <bs:bsui-dialog-popup>
      <bs:bsui-dialog-content>
        <bs:bsui-combobox name="command" placeholder="Type a command or search...">
          <bs:bsui-combobox-input />
          <bs:bsui-combobox-popup>
            <bs:bsui-combobox-option value="dashboard" label="Go to dashboard" />
            <bs:bsui-combobox-option value="deployments" label="Go to deployments" />
            <bs:bsui-combobox-option value="billing" label="Go to billing" />
            <bs:bsui-combobox-option value="new-project" label="Create new project" />
            <bs:bsui-combobox-option value="invite" label="Invite a teammate" />
            <bs:bsui-combobox-option value="rotate-key" label="Rotate API key" />
            <bs:bsui-combobox-option value="theme" label="Toggle dark mode" />
            <bs:bsui-combobox-option value="docs" label="Open documentation" />
            <bs:bsui-combobox-option value="support" label="Contact support" />
          </bs:bsui-combobox-popup>
        </bs:bsui-combobox>
      </bs:bsui-dialog-content>
    </bs:bsui-dialog-popup>
  </bs:bsui-dialog>
  <bs:bsui-text content="or press" variant="caption" tag="span" />
  <bs:bsui-kbd label="Cmd" />
  <bs:bsui-kbd label="K" />
</bs:bsui-stack>

Nasıl çalışır

İletişim kutusu açılınca odak doğrudan birleşik giriş kutusunun girişine geçer; mağazası her tuş vuruşunda hedef listesini bağlamda filtreler. Enter vurgulanan komutu çalıştırıp her iki katmanı kapatır; Escape ise önce listeden, sonra iletişim kutusundan geri çıkar.

Bu sayfadaki her davranış, WordPress Interactivity API özelliğidir: her bileşen kendi deposunu kaydeder, sunucuda işlenen bir bağlamda durumunu başlangıç değerleriyle yükler ve yukarıdaki biçimlendirmede yönergelerle olayları bağlar. Sayfaya özel bir JavaScript yoktur.