MaryUI Documentation
repository·main·Indexed 23 days ago
https://github.com/robsontenorio/maryA UI component library for Livewire applications built on top of daisyUI and Tailwind CSS. It provides a wide range of Blade components for layout, forms, data display, and navigation, including specialized tools like the mary:install and mary:bootcamp CLI commands, a dedicated Mary facade, and custom Blade directives for scoped slots.
What's inside MaryUI
- MaryUI is a collection of UI components designed specifically for Livewire applications. It leverages daisyUI and Tailwind CSS to provide a set of high-quality, ready-to-use components.
Roll back to the stable MaryUI version
mainTo stop using the local development version and revert to the stable version from Packagist, unset the local repository configuration and require the package normally:
composer config --unset repositories.local composer require robsontenorio/maryInstall MaryUI from source for development
mainIf you want to contribute to MaryUI or work with a local version of the package, follow these steps to set up a local path repository in your project:
- Clone the repository into your project's
packagesdirectory:git clone git@github.com:robsontenorio/mary.git packages/mary - Configure Composer to use the local path as a repository:
composer config repositories.local '{"type": "path", "url": "packages/mary"}' - Require the package using the
@devflag to create a local symlink:composer require robsontenorio/mary:@dev - Start your development server:
yarn dev
git clone git@github.com:robsontenorio/mary.git packages/mary composer config repositories.local '{"type": "path", "url": "packages/mary"}' composer require robsontenorio/mary:@dev yarn dev- Clone the repository into your project's
Access the MaryUI Official Documentation
mainFor detailed component usage, API references, and integration guides, visit the official documentation website at https://mary-ui.com.Configure sidebar behavior via attributes
mainWhen using the
sidebarslot within<x-main>, you can pass specific attributes to the sidebar component to control its behavior and appearance. These attributes are consumed by theMaincomponent's internal logic.Sidebar Attributes
drawer: The ID used for the drawer toggle input.right: If present, the sidebar is rendered as adrawer-end(right-side) drawer.right-mobile: If present, the sidebar is rendered as amax-sm:drawer-end(right-side) drawer on small screens.collapsible: A boolean attribute that, when present, enables the collapse/expand toggle menu at the bottom of the sidebar.collapse-icon: Overrides the default collapse icon.collapse-text: Overrides the default collapse text.
Use Mary Blade components
mainMary provides a wide range of Blade components. Components are registered using a prefix defined in yourconfig/mary.phpfile. Additionally, to prevent naming collisions withBladeUI\'sicon component, the icon component is aliased to<x-svg />.Configure image uploads for the Editor
mainThe Editor component automatically handles image uploads via the
mary.uploadroute. You can control where files are stored using thediskandfolderattributes.When an image is inserted, the component performs a
POSTrequest to the upload URL with the following query parameters:disk: The filesystem disk (e.g.,public,s3).folder: The target directory (e.g.,editor)._token: The CSRF token for security.
Example:
<x-mary-editor wire:model="content" disk="s3" folder="uploads/images" />Install maryUI via the CLI
mainUse the
mary:installArtisan command to set up maryUI in your Laravel project. This command automates the installation of Livewire, daisyUI, and Tailwind CSS, configures yourapp.css, and handles component prefixing if starter kits like Jetstream or Breeze are detected.Requirements:
- Laravel 12 or above.
- A package manager installed (
npm,yarn,bun, orpnpm).
Automatic Configuration:
- Starter Kits: If
jetstream,breeze, orlivewire/fluxare detected incomposer.json, the installer will publish themary.configfile and automatically set a global component prefix (mary-) to prevent naming collisions (e.g.,<x-mary-button />). - CSS: By default, it appends daisyUI plugins, maryUI source paths, and custom theme/pagination styles to
resources/css/app.css.
Configure DatePicker options via the config prop
mainYou can pass a
configarray to thex-mary-datepickercomponent to control the underlying Flatpickr instance.Supported configuration keys include:
mode: Set to'range'to enable date range selection.dateFormat: The date format string (e.g.,'Y-m-d H:i').plugins: An array of plugin configurations. Each element should be an associative array where the key is the plugin name and the value is its configuration object.disable: An array of strings representing dates or rules to disable.
Note: When using
mode="range"withwire:model.live, the component automatically handles the synchronization of the range string back to Livewire.Configure the Mary component prefix
mainThe component prefix used for Blade components is configurable via themary.prefixconfiguration key. By default, components are registered using this prefix. For example, if the prefix is set tomary-, you would use<x-mary-button />. You can publish the configuration file to your application using themary.configtag.Configure TinyMCE settings via the config option
mainYou can pass a
configarray to the<x-mary-editor>component to override default TinyMCE settings. This allows you to customize the toolbar, plugins, height, and other TinyMCE-specific parameters.Default settings include:
menubar:falseautomatic_uploads:trueheight:300toolbar:'undo redo | align bullist numlist | outdent indent | quickimage quicktable'quickbars_selection_toolbar:'bold italic underline strikethrough | forecolor backcolor | link blockquote removeformat | blocks'
Example of custom configuration:
<x-mary-editor wire:model="content" :config='[ "height" => 500, "menubar" => true, "plugins" => "advlist autolink lists link image table", "toolbar" => "undo redo | styleselect | bold italic" ]' />Configure image cropping in the File component
mainThe File component includes built-in image cropping capabilities. You can trigger cropping automatically after an upload or manually via configuration.
Key Cropping Options
crop-after-change: If set totrue, the cropping modal will automatically open once the file upload progress reaches 100%.crop-config: An array of configuration options passed directly to the underlying Cropper.js instance (e.g.,viewMode,dragMode,autoCropArea).crop-mime-type: Specifies the MIME type for the cropped image (defaults toimage/png).crop-title-text,crop-cancel-text,crop-save-text: Customizes the text within the cropping modal.
Example: Automatic Cropping
<x-mary-file wire:model="avatar" label="Avatar" crop-after-change :crop-config='["viewMode" => 1, "aspectRatio" => 1]' />