Extensions (PHP) · Components
Components for your pages
Build your pages from the components ForumSpark uses itself: page layout, buttons, menus, dialogs, the editor, filters, the forum picker, reactions and more. Your extension then looks and works like the rest of the forum, in every theme and in dark mode, on phones too.
The catalogue
On a forum with developer mode on, Developer, Components lists every component with a live example in that forum's theme, the code to copy and its options.
| Component | Tag | For |
|---|---|---|
| Page layout | x-forum-layout | Wraps a forum page in the board's header, menu, sidebar and footer. |
| Page header | x-ui.page-head | The title and one-line description at the top of a page, with room for buttons. |
| Button | x-ui.button | For actions and links. Follows the board's theme colours. |
| Menu | x-ui.menu | A list of actions behind a button. One action shows as a plain button by itself. |
| Dialog | x-ui.modal | A window over the page for a short form or a question. |
| Tabs | x-ui.tabs | Switch between views of the same page. |
| Rows | x-ui.rows | A simple list of links or facts, one per row. |
| Choice list | x-ui.select | Pick one option. Use it instead of a plain select, so it matches the theme. |
| Date and time | x-ui.date-time | Pick a date, a time or both, in the member's own time zone. |
| Member picker | x-ui.member-picker | Find a member by name while typing. Use it for every username field. |
| Editor | x-editor | The editor members know from new topics and replies, with the attachment tray inside it. Always put it in a tiptapEditor container. |
| Tags | x-ui.tags-input | Add tags with suggestions from the board's own tags. |
| Avatar | x-avatar | A member's picture in the board's avatar shape. |
| Member name | x-user-link | A member's name, in their group colour, linking to their profile. |
| Time ago | x-relative-time | A date as "3 hours ago" that keeps up to date, with the exact time on hover. |
| Empty state | x-empty-state | What a list shows when there is nothing in it yet. |
| App sidebar | x-app-nav | The sidebar every app uses for its own pages, with headings and counts. |
| Reactions | x-ui.reactions | The board's own reactions, the same as on posts. Give your model HasReactions. |
| Popover | x-ui.popover | A small panel that opens from a button, for filters or a short form. |
| Multiple choice | x-ui.multi-select | Pick several options from a list, with search for long lists. |
| Image upload | x-ui.image-drop | Drop or pick one image, with a preview and a remove button. |
| Attachments | x-attachments | Shows the files attached to your model, under its text, like under a post. |
| Formatted text | x-rich-text | Shows text written in the editor with the same spacing and styles as posts. |
| Tag list | x-ui.tag-list | The tags of one item, linking to the board's tag pages. |
| Filter | x-ui.filter | A Filter button with the number of active filters. Opens a panel on desktop and a sheet on phones, with Reset and Apply. |
| Active filters | x-ui.filter.chips | The filters that are on, each with a remove link, above a filtered list. |
| Topic filter | x-topic-filter | The sort tabs, Filter panel and active filters at the top of a topic list: label, starter, last activity, status, sort, tag and show only. Read the choices with TopicListFilter. |
| Forum picker | x-ui.forum-picker | Choose one forum to post in, with search, recent forums and the board's categories. The same picker as the new topic window. |
| Forum tree | x-ui.forum-tree | Pick forums from the board's categories, with counts and search. Ticking a category ticks its forums. |
| Tag cloud | x-ui.tag-cloud | Popular tags, sized by how often they are used. |
| Sidebar block | x-block | A titled box like the ones in the board sidebar, with a link to see more. |
| Loading placeholder | x-skeleton-rows | Grey shapes while something loads, so the page does not jump. |
| Icon picker | x-fa-icon-picker | Choose a Font Awesome icon from a searchable list. |
| Page numbers | ->links() | Page numbers under a long list, in the board's style. |
| Page | x-acp.page | The title, description and buttons at the top of every admin page. |
| Card | x-acp.card | A white box for a table or a list. |
| Section and field | x-k2-section | A settings form: a section with labelled fields and help text. |
| Switch | x-k2-switch | An on or off setting. |
| Row menu | x-acp.more | The ... menu at the end of a table row. |
| Dialog | x-k2-modal | A window over an admin page. |
| Page numbers | x-acp.pager | Page numbers under an admin table. |
| Icon picker | x-acp.icon-picker | Choose an icon in an admin form. |
| Category table | x-acp.category-table | A list of categories with drag to reorder, counts, edit and delete, like the Blog and Gallery categories. |
A few rules
- Use
x-ui.select,x-ui.date-timeandx-ui.member-pickerinstead of plain form fields, so they match the theme. - Take colours from the theme. The check flags hard-coded colours.
- Wrap forum pages in
x-forum-layoutand admin pages inx-admin-layoutwithx-acp.page.