الأسعار
pricing-11
عنوان في المنتصف وتبويبات شهري / سنوي فوق بطاقتي خطة: الاسم والسعر والزر ثم قائمة الميزات.
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
Each plan carries a monthly price (price + period) and a yearly one
(yearlyPrice + yearlyPeriod); the Monthly / Yearly tabs swap between them.
<x-ui.blocks.pricing-11
tagline="Pricing"
heading="Pick a plan"
description="Cancel any time."
monthly-label="Monthly"
yearly-label="Yearly"
:plans="[
[
'name' => 'Starter',
'description' => 'For side projects',
'price' => '$9',
'period' => '/mo',
'yearlyPrice' => '$90',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
'features' => ['3 projects', 'Email support'],
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'monthlyLabel' => 'Monthly',
'yearlyLabel' => 'Yearly',
'plans' => [
[
'name' => 'Basic plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$19',
'period' => '/mo',
'yearlyPrice' => '$199',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Get started',
'buttonHref' => null,
'features' => array_fill(0, 3, 'Feature text goes here'),
],
[
'name' => 'Business plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$29',
'period' => '/mo',
'yearlyPrice' => '$299',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Get started',
'buttonHref' => null,
'features' => array_fill(0, 5, 'Feature text goes here'),
],
],
])
<section {{ $attributes->merge(['class' => 'w-full bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto max-w-7xl">
<div class="mx-auto mb-12 flex max-w-3xl flex-col items-center gap-3 text-center md:mb-20 md:gap-4">
@if ($tagline)
<p class="font-semibold">{{ $tagline }}</p>
@endif
<div class="flex flex-col gap-5 md:gap-6">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
@if ($description)
<p class="text-muted-foreground md:text-lg">{{ $description }}</p>
@endif
</div>
</div>
<x-ui.tabs :tabs="['monthly' => $monthlyLabel, 'yearly' => $yearlyLabel]" class="mb-10 self-center">
@foreach (['monthly', 'yearly'] as $billing)
<x-slot :name="'tab_' . $billing">
<div class="mx-auto grid max-w-5xl grid-cols-1 gap-8 md:grid-cols-2">
@foreach ($plans as $plan)
@php
$price = $billing === 'yearly' ? $plan['yearlyPrice'] ?? '' : $plan['price'] ?? '';
$period = $billing === 'yearly' ? $plan['yearlyPeriod'] ?? '' : $plan['period'] ?? '';
@endphp
<x-ui.card class="gap-0 rounded-lg py-8 shadow-none">
<div class="flex flex-col gap-6 md:gap-8">
<div class="flex flex-col gap-1">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
@if (!empty($plan['description']))
<p class="text-muted-foreground">{{ $plan['description'] }}</p>
@endif
</div>
<x-ui.separator />
<p class="whitespace-nowrap font-bold">
<span dir="ltr"><span class="text-[2.5rem] leading-[1.2] md:text-[3.5rem]">{{ $price }}</span><span
class="text-2xl leading-[1.4] md:text-[2rem] md:leading-[1.3]">{{ $period }}</span></span>
</p>
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg" class="w-full">
{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
<x-ui.separator />
<ul class="flex flex-col gap-4 py-2">
@foreach ($plan['features'] ?? [] as $feature)
<li class="flex items-start gap-4">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="size-6 shrink-0" aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span>{{ $feature }}</span>
</li>
@endforeach
</ul>
</div>
</x-ui.card>
@endforeach
</div>
</x-slot>
@endforeach
</x-ui.tabs>
</div>
</section>
التثبيت
php artisan ui:add-block pricing-11
أمر واحد يثبّت ملف Blade الخاص بالقالب وكل مكوّن يعتمد عليه. اعرضه في تخطيطك كالتالي
<x-ui.blocks.pricing-11
/>.
1. ثبّت المكونات المطلوبة
php artisan ui:add button card separator tabs
2. حزم خارجية
- composer:
gehrisandro/tailwind-merge-laravel
3.
انسخ كود القالب إلى
resources/views/components/ui/
resources/views/components/ui/blocks/pricing-11.blade.php
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
Each plan carries a monthly price (price + period) and a yearly one
(yearlyPrice + yearlyPeriod); the Monthly / Yearly tabs swap between them.
<x-ui.blocks.pricing-11
tagline="Pricing"
heading="Pick a plan"
description="Cancel any time."
monthly-label="Monthly"
yearly-label="Yearly"
:plans="[
[
'name' => 'Starter',
'description' => 'For side projects',
'price' => '$9',
'period' => '/mo',
'yearlyPrice' => '$90',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
'features' => ['3 projects', 'Email support'],
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'monthlyLabel' => 'Monthly',
'yearlyLabel' => 'Yearly',
'plans' => [
[
'name' => 'Basic plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$19',
'period' => '/mo',
'yearlyPrice' => '$199',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Get started',
'buttonHref' => null,
'features' => array_fill(0, 3, 'Feature text goes here'),
],
[
'name' => 'Business plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$29',
'period' => '/mo',
'yearlyPrice' => '$299',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Get started',
'buttonHref' => null,
'features' => array_fill(0, 5, 'Feature text goes here'),
],
],
])
<section {{ $attributes->merge(['class' => 'w-full bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto max-w-7xl">
<div class="mx-auto mb-12 flex max-w-3xl flex-col items-center gap-3 text-center md:mb-20 md:gap-4">
@if ($tagline)
<p class="font-semibold">{{ $tagline }}</p>
@endif
<div class="flex flex-col gap-5 md:gap-6">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
@if ($description)
<p class="text-muted-foreground md:text-lg">{{ $description }}</p>
@endif
</div>
</div>
<x-ui.tabs :tabs="['monthly' => $monthlyLabel, 'yearly' => $yearlyLabel]" class="mb-10 self-center">
@foreach (['monthly', 'yearly'] as $billing)
<x-slot :name="'tab_' . $billing">
<div class="mx-auto grid max-w-5xl grid-cols-1 gap-8 md:grid-cols-2">
@foreach ($plans as $plan)
@php
$price = $billing === 'yearly' ? $plan['yearlyPrice'] ?? '' : $plan['price'] ?? '';
$period = $billing === 'yearly' ? $plan['yearlyPeriod'] ?? '' : $plan['period'] ?? '';
@endphp
<x-ui.card class="gap-0 rounded-lg py-8 shadow-none">
<div class="flex flex-col gap-6 md:gap-8">
<div class="flex flex-col gap-1">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
@if (!empty($plan['description']))
<p class="text-muted-foreground">{{ $plan['description'] }}</p>
@endif
</div>
<x-ui.separator />
<p class="whitespace-nowrap font-bold">
<span dir="ltr"><span class="text-[2.5rem] leading-[1.2] md:text-[3.5rem]">{{ $price }}</span><span
class="text-2xl leading-[1.4] md:text-[2rem] md:leading-[1.3]">{{ $period }}</span></span>
</p>
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg" class="w-full">
{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
<x-ui.separator />
<ul class="flex flex-col gap-4 py-2">
@foreach ($plan['features'] ?? [] as $feature)
<li class="flex items-start gap-4">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="size-6 shrink-0" aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span>{{ $feature }}</span>
</li>
@endforeach
</ul>
</div>
</x-ui.card>
@endforeach
</div>
</x-slot>
@endforeach
</x-ui.tabs>
</div>
</section>
الاستخدام
Every piece of content is a prop, so you can drive this section from a CMS. Each plan carries a monthly price (price + period) and a yearly one (yearlyPrice + yearlyPeriod); the Monthly / Yearly tabs swap between them.
<x-ui.blocks.pricing-11
tagline="Pricing"
heading="Pick a plan"
description="Cancel any time."
monthly-label="Monthly"
yearly-label="Yearly"
:plans="[
[
'name' => 'Starter',
'description' => 'For side projects',
'price' => '$9',
'period' => '/mo',
'yearlyPrice' => '$90',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
'features' => ['3 projects', 'Email support'],
],
]"
/>
الخصائص
كل خاصية مع قيمتها الافتراضية. مرّر أيًّا منها كسمة، واستخدم : لربط قيمة PHP.
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'monthlyLabel' => 'Monthly',
'yearlyLabel' => 'Yearly',
'plans' => [
[
'name' => 'Basic plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$19',
'period' => '/mo',
'yearlyPrice' => '$199',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Get started',
'buttonHref' => null,
'features' => array_fill(0, 3, 'Feature text goes here'),
],
[
'name' => 'Business plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$29',
'period' => '/mo',
'yearlyPrice' => '$299',
'yearlyPeriod' => '/yr',
'buttonLabel' => 'Get started',
'buttonHref' => null,
'features' => array_fill(0, 5, 'Feature text goes here'),
],
],
])