الأسعار
pricing-01
أربع بطاقات أسعار في صف واحد: اسم الخطة والسعر الشهري وملاحظة السعر السنوي وقائمة ميزات بعلامات صح وزر بعرض كامل.
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
A plan is ['name', 'price', 'period', 'note', 'features', 'buttonLabel',
'buttonHref']. Leave buttonHref out and the button stays a plain button.
<x-ui.blocks.pricing-01
tagline="Pricing"
heading="Pick a plan"
description="Every plan includes unlimited projects."
:plans="[
[
'name' => 'Starter',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['3 seats', 'Email support'],
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
],
[
'name' => 'Team',
'price' => '$29',
'period' => '/mo',
'note' => 'or $290 yearly',
'features' => ['20 seats', 'Priority support', 'SSO'],
'buttonLabel' => 'Start trial',
'buttonHref' => '/register?plan=team',
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Free plan',
'price' => '$0',
'period' => '/mo',
'note' => 'or $0 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Basic plan',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise plan',
'price' => '$49',
'period' => '/mo',
'note' => 'or $499 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])
<section {{ $attributes->merge(['class' => '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 max-w-3xl text-center md:mb-20">
<p class="mb-3 font-semibold md:mb-4">{{ $tagline }}</p>
<h2 class="mb-5 text-4xl font-bold leading-[1.2] md:mb-6 md:text-5xl">{{ $heading }}</h2>
<p class="md:text-lg">{{ $description }}</p>
</div>
<div class="grid grid-cols-1 gap-8 md:grid-cols-2 md:gap-6 lg:grid-cols-4">
@foreach ($plans as $plan)
<x-ui.card class="justify-between gap-8">
<div class="flex flex-col gap-6 md:gap-8">
<div class="flex flex-col gap-2 text-center">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
<p class="font-bold">
<span class="text-5xl leading-[1.2]">{{ $plan['price'] ?? '' }}</span><span
class="text-2xl leading-[1.4]">{{ $plan['period'] ?? '' }}</span>
</p>
@if (!empty($plan['note']))
<p>{{ $plan['note'] }}</p>
@endif
</div>
<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-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-01
أمر واحد يثبّت ملف Blade الخاص بالقالب وكل مكوّن يعتمد عليه. اعرضه في تخطيطك كالتالي
<x-ui.blocks.pricing-01
/>.
1. ثبّت المكونات المطلوبة
php artisan ui:add button card
2. حزم خارجية
- composer:
gehrisandro/tailwind-merge-laravel
3.
انسخ كود القالب إلى
resources/views/components/ui/
resources/views/components/ui/blocks/pricing-01.blade.php
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
A plan is ['name', 'price', 'period', 'note', 'features', 'buttonLabel',
'buttonHref']. Leave buttonHref out and the button stays a plain button.
<x-ui.blocks.pricing-01
tagline="Pricing"
heading="Pick a plan"
description="Every plan includes unlimited projects."
:plans="[
[
'name' => 'Starter',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['3 seats', 'Email support'],
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
],
[
'name' => 'Team',
'price' => '$29',
'period' => '/mo',
'note' => 'or $290 yearly',
'features' => ['20 seats', 'Priority support', 'SSO'],
'buttonLabel' => 'Start trial',
'buttonHref' => '/register?plan=team',
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Free plan',
'price' => '$0',
'period' => '/mo',
'note' => 'or $0 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Basic plan',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise plan',
'price' => '$49',
'period' => '/mo',
'note' => 'or $499 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])
<section {{ $attributes->merge(['class' => '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 max-w-3xl text-center md:mb-20">
<p class="mb-3 font-semibold md:mb-4">{{ $tagline }}</p>
<h2 class="mb-5 text-4xl font-bold leading-[1.2] md:mb-6 md:text-5xl">{{ $heading }}</h2>
<p class="md:text-lg">{{ $description }}</p>
</div>
<div class="grid grid-cols-1 gap-8 md:grid-cols-2 md:gap-6 lg:grid-cols-4">
@foreach ($plans as $plan)
<x-ui.card class="justify-between gap-8">
<div class="flex flex-col gap-6 md:gap-8">
<div class="flex flex-col gap-2 text-center">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
<p class="font-bold">
<span class="text-5xl leading-[1.2]">{{ $plan['price'] ?? '' }}</span><span
class="text-2xl leading-[1.4]">{{ $plan['period'] ?? '' }}</span>
</p>
@if (!empty($plan['note']))
<p>{{ $plan['note'] }}</p>
@endif
</div>
<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-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. A plan is ['name', 'price', 'period', 'note', 'features', 'buttonLabel', 'buttonHref']. Leave buttonHref out and the button stays a plain button.
<x-ui.blocks.pricing-01
tagline="Pricing"
heading="Pick a plan"
description="Every plan includes unlimited projects."
:plans="[
[
'name' => 'Starter',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['3 seats', 'Email support'],
'buttonLabel' => 'Start free',
'buttonHref' => '/register',
],
[
'name' => 'Team',
'price' => '$29',
'period' => '/mo',
'note' => 'or $290 yearly',
'features' => ['20 seats', 'Priority support', 'SSO'],
'buttonLabel' => 'Start trial',
'buttonHref' => '/register?plan=team',
],
]"
/>
الخصائص
كل خاصية مع قيمتها الافتراضية. مرّر أيًّا منها كسمة، واستخدم : لربط قيمة PHP.
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Free plan',
'price' => '$0',
'period' => '/mo',
'note' => 'or $0 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Basic plan',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise plan',
'price' => '$49',
'period' => '/mo',
'note' => 'or $499 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])