انتقل إلى المحتوى
الأدلة
التنقل
التنبيهات
الطبقات العائمة
التخطيط
عرض البيانات
النماذج
.md

التنقل

stepper

يعرض التقدم عبر مسار متعدد الخطوات: الخطوات المكتملة والحالية والقادمة والفاشلة، أفقيًا أو عموديًا.

  1. الحساب (مكتملة) بياناتك
  2. الشحن (مكتملة) عنوان التوصيل
  3. الدفع (الخطوة الحالية) بطاقة أو تحويل
  4. التأكيد (قادمة) المراجعة وإتمام الطلب
  1. الرفع (مكتملة)
  2. التحقق (خطأ)
  3. الاستيراد (قادمة)
  1. تم الطلب (مكتملة)
  2. تم التغليف (مكتملة)
  3. تم الشحن (مكتملة)
  4. تم التسليم (مكتملة)

التثبيت

php artisan ui:add stepper

الاستخدام

<x-ui.stepper :steps="['Account', 'Billing', 'Confirm']" :current="2" />

{{-- With descriptions, links back to finished steps, vertical. --}}
<x-ui.stepper orientation="vertical" :current="$step" :steps="[
    ['title' => 'Account', 'description' => 'Your details', 'href' => route('signup', ['step' => 1])],
    ['title' => 'Billing', 'description' => 'Plan and card', 'href' => route('signup', ['step' => 2])],
    ['title' => 'Confirm', 'description' => 'Review and finish'],
]" />

{{-- A failed step, plus translated screen-reader labels. --}}
<x-ui.stepper :steps="['Upload', 'Validate', 'Import']" :current="2" :error="2"
    :labels="['complete' => 'مكتمل', 'current' => 'الحالي', 'upcoming' => 'قادم', 'error' => 'خطأ']" />

{{-- The controller owns the step. No JavaScript involved:

    public function show(Request $request)
    {
        $step = min(max((int) $request->query('step', 1), 1), 3);

        return view('signup', ['step' => $step]);
    }

    public function store(Request $request)
    {
        // validate the current step, then move on
        return redirect()->route('signup', ['step' => $request->integer('step') + 1]);
    }
--}}

ترميز خالص بلا JavaScript: الخادم يحدد current (يبدأ من 1، وأي قيمة بعد الخطوة الأخيرة تجعل كل الخطوات مكتملة). تقبل steps نصوصًا أو مصفوفات ['title', 'description', 'href']، ولا يصبح href رابطًا إلا للخطوات المكتملة. قيمة orientation هي horizontal أو vertical، وerror يحدد خطوة فاشلة، وlabels تستبدل كلمات الحالة لقارئات الشاشة (complete وcurrent وupcoming وerror).

الخصائص

كل خاصية مع قيمتها الافتراضية. مرّر أيًّا منها كسمة، واستخدم : لربط قيمة PHP.

@props([
    // Strings, or ['title' => ..., 'description' => ..., 'href' => ...].
    'steps' => [],
    // 1-based index of the active step. Past the last step = all complete.
    'current' => 1,
    'orientation' => 'horizontal',
    // 1-based index of a step that failed, or null.
    'error' => null,
    'label' => 'Progress',
    'labels' => [],
])