الأسعار
pricing-12
ثلاث بطاقات خطط مع أيقونة وسعر وملاحظة السعر السنوي وقائمة الميزات المضمنة، تحت عنوان محاذى إلى البداية.
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
'note' sits under the price (for example the yearly equivalent). Pass
'icon' => '<svg ...>' on a plan to replace the default logo tile.
<x-ui.blocks.pricing-12
tagline="Pricing"
heading="Plans that grow with you"
description="Every plan includes a 14-day free trial."
includes-label="What you get:"
:plans="[
[
'name' => 'Starter',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['3 projects', 'Email support'],
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.',
'includesLabel' => 'Includes:',
'plans' => [
[
'name' => 'Basic plan',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => array_fill(0, 3, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => array_fill(0, 4, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise plan',
'price' => '$49',
'period' => '/mo',
'note' => 'or $499 yearly',
'features' => array_fill(0, 5, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])
<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="mb-12 flex max-w-3xl flex-col gap-3 md:mb-18 md:gap-4 lg:mb-20">
@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>
<div class="grid grid-cols-1 gap-8 md:grid-cols-3">
@foreach ($plans as $plan)
<x-ui.card class="justify-between gap-8 rounded-lg py-8 shadow-none">
<div class="flex flex-col gap-8">
<div class="flex flex-col gap-1">
<div class="flex items-start justify-between gap-4">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
@if (!empty($plan['icon']))
{!! $plan['icon'] !!}
@else
<span
class="flex size-12 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground">
<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" aria-hidden="true">
<path d="M12 2 2 7l10 5 10-5-10-5Z" />
<path d="m2 17 10 5 10-5" />
<path d="m2 12 10 5 10-5" />
</svg>
</span>
@endif
</div>
<p class="whitespace-nowrap font-bold">
<span dir="ltr"><span class="text-[2.5rem] leading-[1.2] md:text-[3.5rem]">{{ $plan['price'] ?? '' }}</span><span
class="text-2xl leading-[1.4] md:text-[2rem] md:leading-[1.3]">{{ $plan['period'] ?? '' }}</span></span>
</p>
@if (!empty($plan['note']))
<p class="text-muted-foreground">{{ $plan['note'] }}</p>
@endif
</div>
<x-ui.separator />
<div class="flex flex-col gap-4">
@if ($includesLabel)
<p>{{ $includesLabel }}</p>
@endif
<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>
</div>
<x-slot:footer>
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg" class="w-full">
{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</x-slot:footer>
</x-ui.card>
@endforeach
</div>
</div>
</section>
التثبيت
php artisan ui:add-block pricing-12
أمر واحد يثبّت ملف Blade الخاص بالقالب وكل مكوّن يعتمد عليه. اعرضه في تخطيطك كالتالي
<x-ui.blocks.pricing-12
/>.
1. ثبّت المكونات المطلوبة
php artisan ui:add button card separator
2. حزم خارجية
- composer:
gehrisandro/tailwind-merge-laravel
3.
انسخ كود القالب إلى
resources/views/components/ui/
resources/views/components/ui/blocks/pricing-12.blade.php
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
'note' sits under the price (for example the yearly equivalent). Pass
'icon' => '<svg ...>' on a plan to replace the default logo tile.
<x-ui.blocks.pricing-12
tagline="Pricing"
heading="Plans that grow with you"
description="Every plan includes a 14-day free trial."
includes-label="What you get:"
:plans="[
[
'name' => 'Starter',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['3 projects', 'Email support'],
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.',
'includesLabel' => 'Includes:',
'plans' => [
[
'name' => 'Basic plan',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => array_fill(0, 3, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => array_fill(0, 4, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise plan',
'price' => '$49',
'period' => '/mo',
'note' => 'or $499 yearly',
'features' => array_fill(0, 5, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])
<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="mb-12 flex max-w-3xl flex-col gap-3 md:mb-18 md:gap-4 lg:mb-20">
@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>
<div class="grid grid-cols-1 gap-8 md:grid-cols-3">
@foreach ($plans as $plan)
<x-ui.card class="justify-between gap-8 rounded-lg py-8 shadow-none">
<div class="flex flex-col gap-8">
<div class="flex flex-col gap-1">
<div class="flex items-start justify-between gap-4">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
@if (!empty($plan['icon']))
{!! $plan['icon'] !!}
@else
<span
class="flex size-12 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground">
<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" aria-hidden="true">
<path d="M12 2 2 7l10 5 10-5-10-5Z" />
<path d="m2 17 10 5 10-5" />
<path d="m2 12 10 5 10-5" />
</svg>
</span>
@endif
</div>
<p class="whitespace-nowrap font-bold">
<span dir="ltr"><span class="text-[2.5rem] leading-[1.2] md:text-[3.5rem]">{{ $plan['price'] ?? '' }}</span><span
class="text-2xl leading-[1.4] md:text-[2rem] md:leading-[1.3]">{{ $plan['period'] ?? '' }}</span></span>
</p>
@if (!empty($plan['note']))
<p class="text-muted-foreground">{{ $plan['note'] }}</p>
@endif
</div>
<x-ui.separator />
<div class="flex flex-col gap-4">
@if ($includesLabel)
<p>{{ $includesLabel }}</p>
@endif
<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>
</div>
<x-slot:footer>
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg" class="w-full">
{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</x-slot:footer>
</x-ui.card>
@endforeach
</div>
</div>
</section>
الاستخدام
Every piece of content is a prop, so you can drive this section from a CMS. 'note' sits under the price (for example the yearly equivalent). Pass 'icon' => '<svg ...>' on a plan to replace the default logo tile.
<x-ui.blocks.pricing-12
tagline="Pricing"
heading="Plans that grow with you"
description="Every plan includes a 14-day free trial."
includes-label="What you get:"
:plans="[
[
'name' => 'Starter',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['3 projects', 'Email support'],
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
],
]"
/>
الخصائص
كل خاصية مع قيمتها الافتراضية. مرّر أيًّا منها كسمة، واستخدم : لربط قيمة PHP.
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.',
'includesLabel' => 'Includes:',
'plans' => [
[
'name' => 'Basic plan',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => array_fill(0, 3, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => array_fill(0, 4, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise plan',
'price' => '$49',
'period' => '/mo',
'note' => 'or $499 yearly',
'features' => array_fill(0, 5, 'Feature text goes here'),
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])