diff --git a/README.md b/README.md index 6539d4e8..2b01b595 100644 --- a/README.md +++ b/README.md @@ -1,108 +1,18 @@ -

License


+

License


-BladewindUI is a collection of UI components written purely using TailwindCSS, Laravel blade templates and Vanilla Javascript. These components are super simple to use and come with different levels of customization. -

- -### Installation -The full installation guide is available on https://bladewindui.com/#install. -
- -BladewindUI is very specific to Laravel since all components are written purely using blade syntax. To install in your Laravel project simply run this command in the terminal at the root of your project. -

- -``` -composer require bladewindui/bladewindui -``` -
- -Next you need to **publish the package assets** by running this command, still in the terminal at the root of your Laravel project. - -
- -``` -php artisan vendor:publish --provider="Mkocansey\Bladewind\BladewindServiceProvider" --tag=bladewind-public --force -``` -
- -Now include the BladewindUI css file in the <head> of your pages. This should ideally be done in the layouts file your app pages extend from. - -
- -``` - -``` -``` - -``` - -
- -Finally, include the BladewindUI javascript file anywhere before the closing of the </body> tag of your pages. Again, this should ideally be done in the layouts file your app's pages extend from. - -
- -``` - -``` - -
+This is the Laravel application that powers [bladewindui.com](https://bladewindui.com) — the documentation +site for **BladewindUI**, a collection of UI components written purely using TailwindCSS, Laravel Blade +templates and vanilla JavaScript. -You are now ready to start using any of the BladewindUI components in your application +The component library itself lives in a separate repo: **[bladewindui/ui](https://github.com/bladewindui/ui)**. +That is also where installation instructions and the full, always-current component list live, so they +are not repeated here — this README would just go stale a second time. See its +[README](https://github.com/bladewindui/ui#readme) for both, or the live, generated versions at +[bladewindui.com/install](https://bladewindui.com/install) and [bladewindui.com/components](https://bladewindui.com/components).
-``` -Save User -``` - -

-### Components Include - -- **[Accordion](https://bladewindui.com/component/accordion)** -- **[Alert](https://bladewindui.com/component/alert)** -- **[Avatar](https://bladewindui.com/component/avatar)** -- **[Bell](https://bladewindui.com/component/bell)** -- **[Button](https://bladewindui.com/component/button)** -- **[Card](https://bladewindui.com/component/card)** -- **[Centered Content](https://bladewindui.com/component/centered-content)** -- **[Chart](https://bladewindui.com/component/chart)** -- **[Checkbox](https://bladewindui.com/component/checkbox)** -- **[CheckCard](https://bladewindui.com/component/checkcard)** -- **[Colorpicker](https://bladewindui.com/component/colorpicker)** -- **[Datepicker](https://bladewindui.com/component/datepicker)** -- **[Dropdown](https://bladewindui.com/component/dropdown)** -- **[Dropmenu](https://bladewindui.com/component/dropmenu)** -- **[Empty State](https://bladewindui.com/component/empty-state)** -- **[Filepicker](https://bladewindui.com/component/filepicker)** -- **[Horizontal Line Graph](https://bladewindui.com/component/horizontal-line-graph)** -- **[Icon](https://bladewindui.com/component/icon)** -- **[Input](https://bladewindui.com/component/input)** -- **[List View](https://bladewindui.com/component/list-view)** -- **[Modal](https://bladewindui.com/component/modal)** -- **[Notification](https://bladewindui.com/component/notification)** -- **[Process Indicator](https://bladewindui.com/component/process-indicator)** -- **[Progress Bar](https://bladewindui.com/component/progress-bar)** -- **[Radio Button](https://bladewindui.com/component/radio-button)** -- **[Rating](https://bladewindui.com/component/rating)** -- **[Select](https://bladewindui.com/component/select)** -- **[Statistic](https://bladewindui.com/component/statistic)** -- **[Spinner](https://bladewindui.com/component/spinner)** -- **[Tab](https://bladewindui.com/component/tab)** -- **[Table](https://bladewindui.com/component/table)** -- **[Tag](https://bladewindui.com/component/tag)** -- **[Textarea](https://bladewindui.com/component/textarea)** -- **[Timeline](https://bladewindui.com/component/timeline)** -- **[Timepicker](https://bladewindui.com/component/timepicker)** -- **[Toggle](https://bladewindui.com/component/toggle)** -- **[Verification Code](https://bladewindui.com/component/verification-code)** - -

- -Check out the full documentation on https://bladewindui.com. - -

- ## MCP Documentation The `mcp/` directory contains clean, machine-readable Markdown documentation for every component. These files are intended for consumption by MCP (Model Context Protocol) servers so that AI assistants can understand how to use BladewindUI components. diff --git a/mcp/accordion.md b/mcp/accordion.md index 4d820548..3d38869f 100644 --- a/mcp/accordion.md +++ b/mcp/accordion.md @@ -6,27 +6,26 @@ url: /component/accordion # Accordion -The accordion component allows users to expand or collapse sections of content. It's commonly used to organize information in a compact, accessible way. Each section typically has a header that can be clicked to toggle the visibility of its associated content. +The accordion component lets users expand or collapse sections of content, keeping information compact and accessible. Each section has a clickable header that toggles the visibility of its content. ## Basic Usage -Each accordion item requires a `title` attribute for the clickable header. The body content is placed inside the item tags. - ```blade

- BladewindUI is a collection... + BladewindUI is a collection of super simple but elegant Laravel blade-based UI components using TailwindCSS and vanilla Javascript.

- At the root of your Laravel... + At the root of your Laravel project, type the following composer command in your terminal to pull in the package. +
composer require bladewindui/ui
- BladewindUI has been designed ... + BladewindUI has been designed to not interfere with the existing components in your project.
@@ -34,92 +33,66 @@ Each accordion item requires a `title` attribute for the clickable header. The b ## Custom Title Slot -If the title of your accordion item is not a simple string, you can define your content in a title slot. +If the title of your accordion item is not a simple string, define the content in a `title` slot instead of the `title` attribute. ```blade
-
logo
+
logo
What is BladewindUI library?
-
version 2.8.0
+
version 2.8.0

- BladewindUI is a collection... + BladewindUI is a collection of super simple but elegant Laravel blade-based UI components.

- ...
``` ## Open Multiple Accordion Items -By default only one accordion can stay open at any point in time. You can disable this feature by setting `can_open_multiple="true"`. Now any closed accordion that is clicked will be opened. Likewise, any accordion that is open will be closed when clicked. +By default only one accordion item can stay open at a time. Set `can_open_multiple="true"` to allow any closed item to open without closing the others. ```blade - + -

- BladewindUI is a collection... -

-
- -
- At the root of your Laravel... -
-
- -
- BladewindUI has been designed ... -
+ ...
``` ## Ungrouped Accordions -The examples above showed the accordion items within one card element, each separated by a line. To separate accordion items so they stand alone, set `grouped="false"`. +The examples above group accordion items in one card, separated by lines. To make each item stand alone, set `grouped="false"`. ```blade - + -

- BladewindUI is a collection... -

-
- -
- At the root of your Laravel... -
-
- -
- BladewindUI has been designed ... -
+ ...
``` ## Colourful Accordions -You can define the background colour of the accordion by setting the `color` attribute. This is only enforced if `grouped="false"`. Available colours include: `primary`, `blue`, `red`, `yellow`, `green`, `purple`, `pink`, `orange`, `black`, `cyan`, `violet`, `indigo`, `fuchsia`. +You can set the background colour of the accordion with the `color` attribute. This only takes effect when `grouped="false"`. ```blade - + -

- BladewindUI is a collection... -

+ ... +
+
+ + + + ... -... ``` @@ -129,24 +102,24 @@ You can define the background colour of the accordion by setting the `color` att | Attribute | Default | Description | |---|---|---| -| grouped | true | Should the accordion items be grouped within one card container. If `true`, the accordions are divided by lines and grouped in one big container. `true` \| `false` | -| can_open_multiple | false | Should the accordion allow opening of items without first closing what is open. `true` \| `false` | -| color | _blank_ | The accordion background. Applicable when `grouped="false"`. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | -| no_padding | false | Specifies if there should be air around the accordion group. `true` \| `false` | -| content_can_close | true | Determines if clicking on the accordion content will close it when it is open. `true` \| `false` | -| class | _blank_ | Any additional css classes can be added using this attribute. For example to make your accordion more rounded you can add `class="rounded-2xl"`. | +| grouped | true | Whether the accordion items are grouped within one card container, divided by lines. `true` \| `false` | +| can_open_multiple | false | Whether the accordion allows opening items without first closing what is open. `true` \| `false` | +| color | *blank* | The accordion background. Applies when `grouped="false"`. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | +| no_padding | false | Whether there should be air around the accordion group. `true` \| `false` | +| content_can_close | true | Whether clicking the accordion content closes it when open. `true` \| `false` | +| class | *blank* | Any additional css classes, e.g. `class="rounded-2xl"`. | ### Accordion Item Component | Attribute | Default | Description | |---|---|---| -| open | false | Should the accordion items be opened or closed by default. `true` \| `false` | -| title | _blank_ | Label to display as the title of the accordion. | -| color | _blank_ | The accordion background. Applicable when `grouped="false"`. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | -| class | _blank_ | Any additional css classes can be added using this attribute. | -| no_padding | false | Specifies if there should be air around each accordion item. `true` \| `false` | -| content_can_close | true | Determines if clicking on the accordion content will close it when it is open. `true` \| `false` | -| nonce | null | Used when implementing context security policies and require to pass a nonce to inline scripts. | +| open | false | Whether the accordion item is open or closed by default. `true` \| `false` | +| title | *blank* | Label to display as the title of the accordion. | +| color | *blank* | The accordion background. Applies when `grouped="false"`. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | +| class | *blank* | Any additional css classes, e.g. `class="rounded-2xl"`. | +| no_padding | false | Whether there should be air around the accordion item. `true` \| `false` | +| content_can_close | true | Whether clicking the accordion content closes it when open. `true` \| `false` | +| nonce | null | Nonce value for content security policies applied to inline scripts. Can be set globally via the `script` key in `config/bladewind.php`. | ## Full Example @@ -156,16 +129,12 @@ You can define the background colour of the accordion by setting the `color` att can_open_multiple="false" color="pink" class="rounded-lg shadow-sm"> -... + + ... +
``` - -```blade - -... - -``` diff --git a/mcp/alert.md b/mcp/alert.md index 56a27e8a..c7d906d3 100644 --- a/mcp/alert.md +++ b/mcp/alert.md @@ -6,141 +6,148 @@ url: /component/alert # Alert -The alert component displays inline messages intended to get the attention of your users. Alerts come in two shade variants — `faint` (default) and `dark` — and four prebuilt types: `info`, `error`, `warning`, and `success`. Each prebuilt type has a default icon. Custom colours, icons, and avatars are also supported. - -For floating/overlay alerts, see the [Notification](/component/notification) component instead. +The alert component displays inline messages intended to get the attention of your end users. It comes in two shades, faint and dark (not to be confused with dark mode), and four prebuilt types: `info`, `error`, `warning`, and `success`, each with their own default icon. For a more attention-seeking, floating alert, see the Notification component. ## Basic Usage ```blade - Your subscription is expiring in 19 days. Renew now + Your subscription is expiring in 19 days. + Renew now +``` - - You do not have permission to upload files - +## Faint Coloured Alerts - - Well, this is your first warning. - +By default alerts render in a faint shade. The four prebuilt types are `info` (default), `error`, `warning`, and `success`. - - Files were successfully uploaded - +```blade +Your subscription is expiring in 19 days. Renew now + +You do not have permission to upload files + +Well, this is your first warning. Do that again and I'll wipe your hard disk + +Files were successfully uploaded ``` -## Shades +## Dark Coloured Alerts -Set `shade="dark"` for a darker background variant. +Set `shade="dark"` to get darker colours for any alert type. ```blade Your subscription is expiring in 19 days. + Renew now - - You do not have permission to upload files - +You do not have permission to upload files + +Well, this is your first warning. Do that again and I'll wipe your hard disk + +Files were successfully uploaded ``` -## Hiding Icons +## Without Icons -By default, alerts show both a type icon and a close icon. Both can be hidden independently. +By default the alert shows a close icon and a type icon. Both can be turned off independently with `show_icon="false"` and `show_close_icon="false"`. ```blade -{{-- hide the close icon only --}} - - Message here + + Your subscription is expiring in 19 days. + Renew now -{{-- hide the type icon only --}} - - Message here - +You do not have permission to upload files -{{-- hide both icons --}} - - Message here - +Well, this is your first warning. ``` -## Custom Colours +## More Colours -All BladewindUI palette colours are supported on both `faint` and `dark` shades. +The Alert component can be displayed in any of the colours defined in the BladewindUI palette, in both `dark` and `faint` shades: `pink`, `cyan`, `purple`, `gray`, `violet`, `indigo`, `fuchsia`, `orange`, `transparent`, and more. ```blade -I am a pink alert. -I am a pink alert. Dark version. -I am a cyan alert. -I am a purple alert. -I am an orange alert. -I am a violet alert. -I am an indigo alert. -I am a fuchsia alert. -I am a gray alert. -I am a transparent alert. +I am a pink alert. How do I look? +I am a pink alert. Dark version. How do I look? + +I am a cyan alert. How do I look? +I am a purple alert. How do I look? +I am a gray alert. How do I look? +I am a violet alert. How do I look? +I am a indigo alert. How do I look? +I am a fuchsia alert. How do I look? +I am a orange alert. How do I look? +I am a transparent alert. How do I look? ``` -## Custom Icons +## Other Icons & Avatars -The four prebuilt alert types have their own icons. For other colours or types, set the `icon` attribute to any [Heroicons](https://heroicons.com) name. +The four prebuilt alerts (error, warning, info, success) have their own icons; all others do not. Set the `icon` attribute to any Heroicons icon name to display one. ```blade - - No more alarm snoozing. Wake up! - +No more alarm snoozing. Wake up! Your BladewindUI subscription is expiring soon. Pay up! ``` -To adjust the icon size, use `icon_avatar_css` with TailwindCSS classes. +If the default icon size does not suit your needs, set `icon_avatar_css` to your preferred TailwindCSS classes. ```blade - +
Subscription overdue
- Your BladewindUI subscription is overdue by 3 months. + Your BladewindUI subscription is overdue by 3 months. Please pay before the 30th of this month to + avoid losing your information.
``` -## Avatars - -Use an image as a prefix instead of an icon by setting the `avatar` attribute to an image URL. Avatars are rendered using the [Avatar](/component/avatar) component. +It is also possible to use an avatar instead of an icon, using the Avatar component. The default avatar size is `tiny`; other sizes are available via the `size` attribute. ```blade - + Jane has been added to your friends list -{{-- with a ring and larger size --}} - +
New friend request
Jane C. Doe wants to connect as a friend in your professional network.
2 days ago
``` +Alerts are commonly combined with the Dropmenu component to build a notifications list, using `color="transparent"` so each alert blends into the dropdown. + +```blade + + +
You have 5 new notifications
+
+ + +
Meeting starts in 5 minutes
+ Functional specification meeting +
+
+
+``` + ## Attributes | Attribute | Default | Description | |---|---|---| | type | info | `info` \| `error` \| `warning` \| `success` | | shade | faint | `faint` \| `dark` | -| color | _(blank)_ | Override colour: `primary` `blue` `red` `yellow` `green` `purple` `pink` `orange` `black` `cyan` `violet` `indigo` `fuchsia` `gray` `transparent` | -| show_close_icon | true | Show the dismiss (×) icon. String, not boolean. `true` \| `false` | -| show_icon | true | Show the type icon. String, not boolean. `true` \| `false` | -| icon | _(blank)_ | Any [Heroicons](https://heroicons.com) icon name | -| avatar | _(blank)_ | URL to an image to display as a prefix | -| icon_avatar_css | _(blank)_ | Additional TailwindCSS classes for the icon or avatar | -| size | tiny | Avatar size (inherits from Avatar component): `tiny` `small` `regular` `medium` `big` | -| show_ring | false | Show a ring around the avatar. `true` \| `false` | -| class | _(blank)_ | Additional CSS classes applied to the alert wrapper | +| show_close_icon | true | Whether the close icon is shown. Must be set as a string, not a boolean. `true` \| `false` | +| show_icon | true | Whether the alert type icon is displayed. Must be set as a string, not a boolean. `true` \| `false` | +| color | *blank* | Additional colours for the alert background. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | +| icon | *blank* | Icon to display as a prefix to the alert message. Any Heroicons icon name. | +| avatar | *blank* | Url to an avatar, displayed as a prefix using the Avatar component. | +| icon_avatar_css | *blank* | Additional css applied to the avatar or icon prefix. Any TailwindCSS classes. | +| size | tiny | Size of the avatar, inherited from the Avatar component. | +| show_ring | false | Whether the avatar displays a ring around it. `true` \| `false` | +| class | *blank* | Any additional css classes, e.g. `class="rounded-lg"`. | ## Full Example @@ -154,7 +161,7 @@ Use an image as a prefix instead of an icon by setting the `avatar` attribute to icon="briefcase" icon_avatar_css="bg-slate-800" show_ring="true" - avatar="/assets/images/me.jpg" + avatar="/path/to/image.jpg" size="small" class="rounded-lg shadow-sm"> Stay safe. Wash your hands for 20 seconds diff --git a/mcp/avatar.md b/mcp/avatar.md index 02239c84..fd7dd31b 100644 --- a/mcp/avatar.md +++ b/mcp/avatar.md @@ -6,9 +6,9 @@ url: /component/avatar # Avatar -The avatar component allows you to display a rounded picture at different sizes. This component can be useful for displaying pictures of logged-in users, a contact list, directory of employees, etc. The avatar component can either display a single image or a horizontal stack of images. A default placeholder image is used when the `image` attribute is either blank or not specified. +The avatar component displays a rounded picture at different sizes. It is useful for showing pictures of logged-in users, contact lists, employee directories, and similar UI. It can display a single image or a horizontal stack of images. A default placeholder image is used when `image` is blank or not specified. -## Single Avatar +## Basic Usage ```blade @@ -19,60 +19,33 @@ The avatar component allows you to display a rounded picture at different sizes. You can specify a size for the avatar. The default size is `regular`. ```blade - - - - - - -// this is the default - - - - - - - + + + + {{-- default: regular --}} + + + ``` ## Stacked Avatars -Stacked avatars are a series of avatars overlapping each other. The component will not restrict you from stacking avatars of different sizes but, for a more appealing visual effect, stacking images of the same size is advised. You can achieve 'stackability' by using the `x-bladewind::avatars` component and setting `stacked="true"`. +Stacked avatars overlap each other. Use the `x-bladewind::avatars` component and set `stacked="true"`. Stacking avatars of different sizes is not restricted, but stacking images of the same size looks best. ```blade - - ``` ### Plus More -There are cases where you have several avatars but only want to display a specific number and indicate how many more there are. You can achieve this by setting the `plus` attribute to any positive whole number. Setting the `plus` attribute automatically sets `stacked="true"`. BladewindUI also allows you to specify an action for your "plus more" avatar by specifying the `plus_action` attribute. This accepts a Javascript function. +To display a limited number of avatars and indicate how many more exist, set the `plus` attribute to a positive whole number. This automatically sets `stacked="true"`. You can also define an action for the "plus more" avatar with `plus_action`, which accepts a JavaScript function call. ```blade - - - - + @@ -80,24 +53,19 @@ There are cases where you have several avatars but only want to display a specif ## Dot Indicator -Avatars can be displayed with a status indicator. These statuses could be online, offline, invisible. To show a dot indicator on an avatar simply set `dotted="true"`. +Avatars can display a status indicator (online, offline, invisible, etc). Set `dotted="true"` to show a dot indicator. ```blade - + ``` -By default the dot indicator is displayed at the base of the avatar. To change the position to the top of the avatar, set the `dot_position="top"` attribute. +By default the dot is at the base of the avatar. Set `dot_position="top"` to move it to the top. ```blade - + ``` -The dot is available in different colours. Set the `dot_color` attribute to any of the colours compiled into BladewindUI. +The dot supports different colours, useful for matching your theme or indicating different statuses. Set `dot_color` to any of the supported colours. ```blade @@ -109,33 +77,19 @@ The dot is available in different colours. Set the `dot_color` attribute to any ## Labels -You may have seen on websites where the initials of your name are displayed if you have not set a profile image. You can achieve this by specifying a value for the `label` attribute. A label is also displayed when the `image` specified is three or less characters long. +If no image is set, you can display initials instead by specifying the `label` attribute. A label is also displayed automatically when `image` is three or fewer characters long. ```blade -``` - -```blade -``` - -```blade -``` - -Stacked avatars with labels and dot indicators: -```blade -``` - -Avatars with custom background and dot colours: -```blade @@ -145,35 +99,35 @@ Avatars with custom background and dot colours: ## Attributes -### Avatars Component Attributes +### Avatars Component | Attribute | Default | Description | |---|---|---| -| size | regular | Specifies the size of all the avatars in the group. `tiny` \| `small` \| `medium` \| `regular` \| `big` \| `huge` \| `omg` | -| stacked | false | Specifies if the avatars are displayed as a stack. `true` \| `false` | -| dotted | false | Specifies if the avatars have dot indicators. `true` \| `false` | -| dot_color | green | Specifies what colour to use as the dot indicator. Only relevant if _dotted=true_. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `gray` \| `cyan` | -| dot_position | bottom | Specifies where the dot indicator should be placed. Only relevant if _dotted=true_. `top` \| `bottom` | -| show_ring | true | By default avatars show a ring around them. Setting this can turn it off or back on. `true` \| `false` | -| plus | null | Display a last avatar with +XX in the box indicating how many more avatars there are. Must be a positive integer greater than zero. | -| plus_action | null | The Javascript action to perform when the +XX avatar is clicked. | -| bg_color | null | Display background colour when displaying avatars as labels. This sets the ring colour too. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | -| class | mr-2 mt-2 | Any additional css classes can be added using this attribute. This only affects the avatars container. | - -### Avatar Component Attributes +| size | regular | Size of all avatars in the group. `tiny` \| `small` \| `medium` \| `regular` \| `big` \| `huge` \| `omg` | +| stacked | false | Whether the avatars are displayed as a stack. `true` \| `false` | +| dotted | false | Whether the avatars have dot indicators. `true` \| `false` | +| dot_color | green | Colour of the dot indicator. Only relevant if `dotted=true`. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `gray` \| `cyan` | +| dot_position | bottom | Where the dot indicator is placed. Only relevant if `dotted=true`. `top` \| `bottom` | +| show_ring | true | Whether avatars show a ring around them. `true` \| `false` | +| plus | null | Displays a last avatar with +XX indicating how many more avatars there are. Must be a positive integer greater than zero. | +| plus_action | null | JavaScript action to perform when the +XX avatar is clicked. | +| bg_color | null | Background colour when displaying avatars as labels. Also sets the ring colour. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `black` \| `cyan` \| `violet` \| `indigo` \| `fuchsia` | +| class | mr-2 mt-2 | Any additional css classes, applied to the avatars container. | + +### Avatar Component | Attribute | Default | Description | |---|---|---| -| image | _public/vendor/bladewind/images/avatar.png_ | The url to the image file. By default a generic headshot image is used if no url is passed. The image will be displayed as a label if it is three characters long or less. | -| alt | image | The text to display as the value for the image's alt attribute. | -| size | regular | Specifies the size of the avatar. `tiny` \| `small` \| `medium` \| `regular` \| `big` \| `huge` \| `omg` | -| stacked | false | Specifies if the avatar images are displayed as a stack. `true` \| `false` | -| dotted | false | Specifies if the avatar images have dot indicators. `true` \| `false` | -| dot_color | green | Specifies what colour to use as the dot indicator. Only relevant if _dotted=true_. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `gray` \| `cyan` | -| dot_position | bottom | Specifies where the dot indicator should be placed. Only relevant if _dotted=true_. `top` \| `bottom` | -| label | null | Text to display in place of an image. Usually two characters. | -| show_ring | true | By default avatars show a ring around them. Setting this can turn it off or back on. `true` \| `false` | -| class | mr-2 mt-2 | Any additional css classes can be added using this attribute. | +| image | *public/vendor/bladewind/images/avatar.png* | Url to the image file. Defaults to a generic headshot image if not passed. Displayed as a label if three characters or fewer. | +| alt | image | Text for the image's alt attribute. | +| size | regular | Size of the avatar. `tiny` \| `small` \| `medium` \| `regular` \| `big` \| `huge` \| `omg` | +| stacked | false | Whether the avatar image is displayed as part of a stack. `true` \| `false` | +| dotted | false | Whether the avatar has a dot indicator. `true` \| `false` | +| dot_color | green | Colour of the dot indicator. Only relevant if `dotted=true`. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `purple` \| `pink` \| `orange` \| `gray` \| `cyan` | +| dot_position | bottom | Where the dot indicator is placed. Only relevant if `dotted=true`. `top` \| `bottom` | +| label | null | Text displayed in place of an image, usually two characters. | +| show_ring | true | Whether the avatar shows a ring around it. `true` \| `false` | +| class | mr-2 mt-2 | Any additional css classes. | ## Full Example @@ -188,9 +142,7 @@ Avatars with custom background and dot colours: plus_action="showMorePictures()" stacked="true" class="ring-blue-200 ring-offset-2" /> -``` -```blade ``` diff --git a/mcp/bell.md b/mcp/bell.md index 0bd18061..355ad042 100644 --- a/mcp/bell.md +++ b/mcp/bell.md @@ -6,31 +6,33 @@ url: /component/bell # Bell -The bell component displays a bell icon with an optional 'pending notifications' dot indicator. This is a visually pleasing way of telling your app users where to find notifications and if they have anything unread. By default, the bell displays the dot indicator, meaning there are notifications to be read. +The bell component displays a bell icon with an optional pending-notifications dot indicator. It's a visually pleasing way to tell users where to find notifications and whether they have anything unread. By default the dot indicator is shown, meaning there are notifications to read. + +## Basic Usage ```blade ``` -### No Dot Indicator +## No Dot Indicator -To display the bell with no dot indicator, set `show_dot="false"`. This hides the dot indicator. This should usually be the case if all notifications have been read. +Set `show_dot="false"` to hide the dot indicator. This should usually be the case once all notifications have been read. ```blade ``` -### Animated Dot Indicator +## Animated Dot Indicator -The dot indicator can have a 'ping' animation to draw attention to the bell. To animate the dot set `animate_dot="true"`. By default, the dot is not animated. +The dot indicator can have a "ping" animation to draw attention to the bell. Set `animate_dot="true"`. It is not animated by default. ```blade ``` -### Inverted Bell +## Inverted Bell -By default, the bell is designed to sit on a white background. When using the bell on a dark background, set the attribute `invert="true"`. This will display the bell as white. +By default the bell is designed to sit on a white background. When using it on a dark background, set `invert="true"` to display the bell as white. ```blade @@ -38,106 +40,74 @@ By default, the bell is designed to sit on a white background. When using the be ## Different Sizes -The bell component exists in two sizes: `small` and `big`. The default size is `small`. - -```blade -// size="small" can be omitted since it is the default - -``` +The bell component exists in two sizes, `small` (default) and `big`. ```blade + {{-- default, can be omitted --}} ``` ## Different Colours -The default dot indicator displayed next to the bell is blue. This may not match your app's theme, so it is possible to display the dot indicator in different colours by setting the `color` attribute. +The default dot indicator colour is blue. To match your app's theme, set the `color` attribute to any of the supported colours. ```blade - - - - - - - - - - - - - - ``` ## Events -In most apps the bell is accessed either using onclick or onmouseover events. You can add these events to the component as you normally would to any tag. Alternatively, you could wrap the bell component in any other HTML tag that accepts click and hover events. +The bell is usually accessed via onclick or onmouseover events, which can be added to the component like any other HTML tag. Alternatively, wrap the bell in another HTML tag that accepts click and hover events. -The example below wraps the Bell component in the [Dropmenu](/component/dropmenu) component. The Dropmenu component then uses the [List View](/component/listmenu) component to display a list of notifications. +A common pattern wraps the Bell component in the Dropmenu component, which uses the List View component to display a list of notifications. ```blade - - - - - + + + +
- - Michael - - assigned a task to you + Michael assigned a task to you
3 hours ago
-
- - - ... - - -
-
- + + + +
``` ### Onclick, Onmouseover, On-anything -As seen in the example above, the Bell component inherits the default action defined in the Dropmenu component. If you prefer to design your own notification layout or redirect users to a page that lists their notifications, you can define any HTML event attribute on the Bell. +If you prefer your own notification layout, or want to redirect users to a notifications page, define any HTML event attribute directly on the Bell. ```blade - -``` - -```blade - + + ``` ## Attributes | Attribute | Default | Description | |---|---|---| -| color | _blue_ | The colour of the dot indicator. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `pink` \| `cyan` \| `black` \| `purple` \| `orange` \| `violet` \| `indigo` \| `fuchsia` | -| animate_dot | false | Determines if the dot should be animated or not. | -| size | small | Defines the size of the bell. `small` \| `big` | -| show_dot | true | Defines if the dot indicator should be displayed by default. `true` \| `false` | -| invert | false | Defines if the bell should be displayed as white. `true` \| `false` | +| color | blue | Colour of the dot indicator. `primary` \| `blue` \| `red` \| `yellow` \| `green` \| `pink` \| `cyan` \| `black` \| `purple` \| `orange` \| `violet` \| `indigo` \| `fuchsia` | +| animate_dot | false | Whether the dot should be animated. | +| size | small | Size of the bell. `small` \| `big` | +| show_dot | true | Whether the dot indicator is displayed by default. `true` \| `false` | +| invert | false | Whether the bell should be displayed as white. `true` \| `false` | ## Full Example diff --git a/mcp/breadcrumbs.md b/mcp/breadcrumbs.md new file mode 100644 index 00000000..b1cb078c --- /dev/null +++ b/mcp/breadcrumbs.md @@ -0,0 +1,132 @@ +--- +title: Breadcrumbs Component +component: x-bladewind::breadcrumbs +url: /component/breadcrumbs +--- + +# Breadcrumbs + +Breadcrumbs are the small trail of links near the top of a page that tells people where they are and how they got there. They matter most once a site has more than a couple of levels to it. This component builds that trail for you and takes care of the accessibility details that are easy to forget: it wraps everything in a proper navigation region with a plain list inside, so a screen reader announces it as a real breadcrumb trail rather than a row of unrelated text. + +To build a trail, list items in order from the top of the site down to the current page, and add the `current` attribute to the final item. + +## Basic Usage + +```blade + + Home + Components + Breadcrumbs + +``` + +## Linked And Current Items + +Give an item an `href` to make it a clickable link; otherwise it renders as plain text. Usually the last item has no `href`. If the current page also needs to work as a link (for example, clicking it refreshes the page or resets a view), add both `href` and `current` to the same item. + +```blade + + Home + Customers + Customer details + +``` + +## Icons + +Add a small icon next to any item's text using `icon`, and control its look with `icon-type` and `icon-dir`. These work exactly like the [Icon component](/component/icon). Leave `icon-dir` empty to use the built-in icon set, or give it a folder name inside your app's `public` directory to load your own SVG file from there instead. + +```blade + + Home + Settings + Profile + +``` + +## Separator Options + +By default, each item is separated by a chevron. Swap it by setting `separator` to `slash`, `dot`, or any character of your choice. Changing the separator only changes what sits between items. + +```blade +... +... +``` + +## Sizes + +Set `size` to one of six available sizes, from smallest `tiny` up to largest `large`, with `regular` as the default. + +```blade +... +``` + +## Long And Collapsed Trails + +Once a trail reaches four items or more, this component quietly hides the middle items on narrow screens, keeping only the first item and the current page visible, with a marker in between showing something has been tucked away. Every hidden link is still in the document. Set `collapse="false"` to always show the full trail regardless of screen width. + +```blade +... +``` + +## Dark Mode And RTL + +Colours automatically match the active theme, and no separate dark-mode styling is needed. The trail follows whatever reading direction the surrounding page has set. Set `dir="rtl"` directly on a breadcrumb to force right-to-left for that trail alone; the chevron separators flip direction to match. + +```blade +... +``` + +## Accessibility + +- Give the trail a short, clear `aria-label`, such as "Breadcrumb" or a description of the section it belongs to. It defaults to "Breadcrumb" if omitted. +- Always mark exactly one item, the current page, with `current`. This tells assistive technology which step is the current one. +- Write labels that make sense on their own, since a screen reader user might jump straight to the trail without reading the rest of the page. +- Separators, and the marker shown when items are hidden, are hidden from screen readers since they are purely visual. +- Every linked item is a genuine anchor tag, so keyboard tabbing and activation work without any custom handling. + +## Attributes + +### Breadcrumbs Component + +| Attribute | Default | Description | +|---|---|---| +| separator | chevron | What to show between items. `chevron` \| `slash` \| `dot`, or your own text. | +| size | regular | `tiny` \| `small` \| `regular` \| `medium` \| `big` \| `large` | +| collapse | true | Hide middle items on narrow screens once the trail reaches four items or more. `true` \| `false` | +| aria-label | Breadcrumb | Screen reader label for the navigation trail. | +| class | _(blank)_ | Extra classes added to the trail's outer wrapper. | +| Any HTML attribute | | Forwarded to the trail's outer wrapper, including `dir`, `id`, or data attributes. | + +### Breadcrumbs Item Component + +| Attribute | Default | Description | +|---|---|---| +| href | null | Link destination. Omit to render as plain text. | +| current | false | Marks this item as the current page. `true` \| `false` | +| icon | null | Icon name to show next to the item's text. | +| icon-type | outline | `outline` \| `solid` | +| icon-dir | _(blank)_ | Folder inside `public` to load a custom icon from. Blank uses the built-in icon set. | +| class | _(blank)_ | Extra classes added to this item's link or text. | +| Any HTML attribute | | Forwarded to this item's link or text element, including `title`, `rel`, or data attributes. | + +## Full Example + +```blade + + + Settings + + +``` diff --git a/mcp/button.md b/mcp/button.md index 76269a68..c55a06e0 100644 --- a/mcp/button.md +++ b/mcp/button.md @@ -6,156 +6,188 @@ url: /component/button # Button -The button component renders as an HTML `