定制 mrshanebarron/empty-state 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrshanebarron/empty-state

最新稳定版本:v1.0.4

Composer 安装命令:

composer require mrshanebarron/empty-state

包简介

Empty state placeholder component for Laravel - supports Livewire and Vue

README 文档

README

An empty state placeholder component for Laravel applications. Displays friendly messages when content is missing. Works with Livewire and Vue 3.

Installation

composer require mrshanebarron/empty-state

Livewire Usage

Basic Usage

<livewire:sb-empty-state
    title="No items found"
    description="Get started by creating your first item."
/>

With Icon

<livewire:sb-empty-state
    title="No messages"
    description="Your inbox is empty."
    icon="inbox"
/>

With Action Button

<livewire:sb-empty-state
    title="No projects"
    description="Create a project to get started."
    action-text="Create Project"
    action-url="/projects/create"
/>

Livewire Props

Prop Type Default Description
title string 'No items' Main heading
description string null Subtext description
icon string null Icon name/type
action-text string null Button text
action-url string null Button link

Vue 3 Usage

Setup

import { SbEmptyState } from './vendor/sb-empty-state';
app.component('SbEmptyState', SbEmptyState);

Basic Usage

<template>
  <SbEmptyState
    title="No results found"
    description="Try adjusting your search or filters."
  />
</template>

With Icon

<template>
  <SbEmptyState
    title="No notifications"
    description="You're all caught up!"
    icon="bell"
  />
</template>

With Action

<template>
  <SbEmptyState
    title="No team members"
    description="Invite your team to collaborate."
    action-text="Invite Team"
    @action="openInviteModal"
  />
</template>

<script setup>
const openInviteModal = () => {
  // Handle action
};
</script>

Conditional Rendering

<template>
  <div v-if="items.length > 0">
    <!-- List items -->
  </div>
  <SbEmptyState
    v-else
    title="No items yet"
    description="Create your first item to get started."
    action-text="Create Item"
    @action="createItem"
  />
</template>

Custom Slot Content

<template>
  <SbEmptyState title="Custom Content">
    <template #icon>
      <MyCustomIcon class="w-12 h-12 text-gray-400" />
    </template>

    <template #description>
      <p class="text-gray-500">
        Need help? <a href="/docs" class="text-blue-500">Read the docs</a>
      </p>
    </template>

    <template #action>
      <div class="flex gap-2">
        <button class="btn-primary">Create</button>
        <button class="btn-secondary">Import</button>
      </div>
    </template>
  </SbEmptyState>
</template>

Vue Props

Prop Type Default Description
title String 'No items' Heading text
description String null Description text
icon String null Icon identifier
actionText String null Action button text
actionUrl String null Action link URL

Events

Event Description
action Button clicked (when no actionUrl)

Slots

Slot Description
icon Custom icon content
description Custom description content
action Custom action buttons

Common Use Cases

  • Empty search results
  • No data in tables
  • Empty inbox/notifications
  • New user onboarding
  • Filtered results with no matches

Styling

Uses Tailwind CSS:

  • Centered layout
  • Gray icon
  • Large title text
  • Muted description
  • Primary action button

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • Tailwind CSS 3.x

License

MIT License

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固