İçeriğe geç

Örnekler

Çalışma alanı seçici

Hızlı geçiş için menüyü, yeni çalışma alanı oluşturmak için formu kullanan bir oluşturma iletişim kutusuyla seçici menüsünü birleştiren çalışma alanı başlığı.

Önizleme

Acme Inc Pro plan, 8 members
HTML
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
  <bs:bsui-stack direction="row" gap="3" align="center">
    <bs:bsui-avatar fallback="AC" alt="Acme Inc" />
    <bs:bsui-stack direction="column" gap="1">
      <bs:bsui-text content="Acme Inc" variant="label" tag="span" />
      <bs:bsui-text content="Pro plan, 8 members" variant="caption" tag="span" />
    </bs:bsui-stack>
  </bs:bsui-stack>
  <bs:bsui-stack direction="row" gap="2" align="center">
    <bs:bsui-menu>
      <bs:bsui-menu-trigger trigger_label="Switch" trigger_variant="outline" />
      <bs:bsui-menu-popup>
        <bs:bsui-menu-item label="Acme Inc" />
        <bs:bsui-menu-item label="Northwind Labs" />
        <bs:bsui-menu-item label="Personal" />
      </bs:bsui-menu-popup>
    </bs:bsui-menu>
    <bs:bsui-dialog>
      <bs:bsui-dialog-trigger trigger_label="New workspace" />
      <bs:bsui-dialog-backdrop />
      <bs:bsui-dialog-popup>
        <bs:bsui-dialog-header>
          <bs:bsui-dialog-title content="Create a workspace" />
          <bs:bsui-dialog-description content="Workspaces keep projects, members and billing separate." />
        </bs:bsui-dialog-header>
        <bs:bsui-dialog-content>
          <bs:bsui-stack direction="column" gap="4" align="stretch">
            <bs:bsui-field>
              <bs:bsui-field-label text="Name" />
              <bs:bsui-input name="workspace_name" placeholder="Acme Inc" />
            </bs:bsui-field>
            <bs:bsui-field>
              <bs:bsui-field-label text="Plan" />
              <bs:bsui-select name="plan" defaultValue="free" placeholder="Pick a plan">
                <bs:bsui-select-trigger />
                <bs:bsui-select-popup>
                  <bs:bsui-select-option value="free" label="Free" />
                  <bs:bsui-select-option value="pro" label="Pro" />
                  <bs:bsui-select-option value="enterprise" label="Enterprise" />
                </bs:bsui-select-popup>
              </bs:bsui-select>
              <bs:bsui-field-description text="Free includes three projects and two members." />
            </bs:bsui-field>
          </bs:bsui-stack>
        </bs:bsui-dialog-content>
        <bs:bsui-dialog-footer>
          <bs:bsui-dialog-close variant="outline" label="Cancel" />
          <bs:bsui-dialog-close variant="default" label="Create workspace" />
        </bs:bsui-dialog-footer>
      </bs:bsui-dialog-popup>
    </bs:bsui-dialog>
  </bs:bsui-stack>
</bs:bsui-stack>

Nasıl çalışır

Menü mağazası çalışma alanlarını bağlamdan listeler ve geçiş etkin kimliği günceller; başlıktaki kimlik bilgileri de bu kimliğe göre yeniden oluşturulur. İletişim kutusu formu adı doğrular; yeni bir çalışma alanı oluşturulunca aynı mağazaya eklenir ve ardından ona geçilir.

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.