Installation

Start by installing the package using composer.

Install package via composer

composer require electrik/slate

Many of Electrik Slate's component have (and will have) placeholders for icons. For these icons, it uses blade blade-carbon-icons. You may use other icon sets available here - blade-icons. Although officially we use only Carbon Icons.

Install Tailwind CSS

If not already, install the npm dependencies for Tailwind CSS

npm install @tailwindcss/aspect-ratio @tailwindcss/forms @tailwindcss/typography --save-dev

You can find the detailed installation setup and steps for Tailwind CSS with Laravel here.

Setup

In your Laravel's root tailwind.config.js file, require the plugins we installed as shown below:

{
plugins: [
        require('@tailwindcss/aspect-ratio'),
        require('@tailwindcss/forms'),
        require('@tailwindcss/typography'),
    ],
...
}

Next, your should define the a color scheme for your project:

{
...
theme: {
        extend: {
            colors: {
                danger: colors.rose,
                primary: colors.blue,
                success: colors.green,
                warning: colors.yellow,
            },
            fontFamily: {
                sans: ['Inter', ...fontFamily.sans],
            },
        },
    },
...
}

Your final tailwind.config.js should look like this:

const colors = require('tailwindcss/colors')
const { fontFamily } = require('tailwindcss/defaultTheme')

module.exports = {
    purge: [
        './resources/**/*.blade.php',
        './vendor/electrik/slate/resources/views/components/**/*.blade.php',
        './vendor/electrik/slate/src/Helpers/SlateUiHelper.php',
    ],
    theme: {
        extend: {
            colors: {
                danger: colors.rose,
                primary: colors.blue,
                success: colors.green,
                warning: colors.yellow,
            },
            fontFamily: {
                sans: ['Inter', ...fontFamily.sans],
            },
        },
    },
    plugins: [
        require('@tailwindcss/aspect-ratio'),
        require('@tailwindcss/forms'),
        require('@tailwindcss/typography'),
    ],
}

Start Using

That's it! Once installed and setup, you can start using the Slate UI Kit in your Laravel views.

For example, for badge using the following will generate badges

xs badge default badge
<x-slate::badge color="success" size="xs">xs badge</x-slate::badge> <x-slate::badge color="info">default badge</x-slate::badge>

Happy coding!

time Last updated on 2024-08-24T05:26:56+00:00

Stay in Touch

Be the first to know about the latest releases and features.