Giter VIP home page Giter VIP logo

filament-table-repeater's Introduction

Table Repeater Plugin

Latest Version on Packagist Total Downloads

table-repeater-og

Installation

You can install the package via composer:

composer require awcodes/filament-table-repeater

In an effort to align with Filament's theming methodology you will need to use a custom theme to use this plugin.

Note If you have not set up a custom theme and are using a Panel follow the instructions in the Filament Docs first. The following applies to both the Panels Package and the standalone Forms package.

  1. Import the plugin's stylesheet in your theme's css file.
@import '<path-to-vendor>/vendor/awcodes/filament-table-repeater/resources/css/plugin.css';
  1. Add the plugin's views to your tailwind.config.js file.
content: [
    '<path-to-vendor>/awcodes/filament-table-repeater/resources/**/*.blade.php',
]

Usage

This field has most of the same functionality of the Filament Forms Repeater field. The main exception is that this field can not be collapsed.

TableRepeater::make('social')
    ->schema([
        Select::make('platform')
            ->disableLabel()
            ->options([
                'facebook' => 'Facebook',
                'twitter' => 'Twitter',
                'instagram' => 'Instagram'
            ]),
        TextInput::make('handle')
            ->disableLabel(),
    ])
    ->columnSpan('full')

By default, Table Repeater will automatically create the table headers from your schema labels. This can be overridden by simply passing an array of your desired headers to the headers() method.

TableRepeater::make('social')
    ->headers(['Platform', 'Handle'])

Labels

To automatically hide all the labels of the fields in the table use the hideLabels() method.

TableRepeater::make('social')
    ->hideLabels()

Empty State Label

To customize the text shown when the table is empty, use the emptyLabel() method.

TableRepeater::make('social')
    ->emptyLabel('There is no platform registered.')

Alternatively, you can hide the empty label with emptyLabel(false).

Without Header

Sometimes we don't want to have the table header at all. To achieve this, use the withoutHeader() method.

TableRepeater::make('social')
    ->withoutHeader()

Column Widths

To set the width of columns in the table use the columnWidths() method. Widths should be set in px as a string. For fields that don't have names, such as Actions and Group, you have to give it an explicit id to target.

TableRepeater::make('social')
    ->columnWidths([
        'platform' => '200px',
        'action_field' => '100px',
    ])
    ->schema([
        Select::make('platform'), // will be 200px wide
        TextInput::make('handle'), // will be default stretched width
        Actions::make([
            ...
        ])->id('action_field'), // will be 100px wide
    ])

Break Point

Below a specific break point the table will render as a set of panels to make working with data easier on mobile devices. The default is 'md', but can be overridden with the breakPoint() method.

TableRepeater::make('social')
    ->breakPoint('sm') // accepts Tailwind CSS screen sizes

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-table-repeater's People

Contributors

awcodes avatar dependabot[bot] avatar margarizaldi avatar github-actions[bot] avatar danielbehrendt avatar kzrinski avatar oddvalue avatar aabosham avatar howdu avatar billmn avatar cannonb4ll avatar rickdbcn avatar salimabsi avatar gergo85 avatar donmbelembe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.