|
| 1 | +--- |
| 2 | +title: Component library |
| 3 | +tags: |
| 4 | + - Coding_guidelines |
| 5 | + - Core_development |
| 6 | + - Developer_tools |
| 7 | + - Guidelines_for_contributors |
| 8 | + - Interfaces |
| 9 | + - Moodle_User_Interface_Guidelines |
| 10 | + - Processes |
| 11 | + - Themes |
| 12 | + - Usability |
| 13 | +--- |
| 14 | + |
| 15 | +The Component Library is a developer tool provided to help identify frequently-used user interface components, and encourage their re-use. |
| 16 | + |
| 17 | +It includes components from both Twitter Bootstrap, and from Moodle, and it displays these features using your current Moodle theme. |
| 18 | + |
| 19 | +This should help you to work on your theme features, bringing together most of Moodle into one convenient location. |
| 20 | + |
| 21 | +The library is a tool for visual designers, front-end developers, UX developers and anybody creating core Moodle code or Moodle extensions. Its use will allow you to create user interfaces more efficiently. |
| 22 | + |
| 23 | +## Getting started |
| 24 | + |
| 25 | +### Where is the Component Library? |
| 26 | + |
| 27 | +The library is built right into Moodle, but is only shown to developers. You can find it in your site by navigating to Site administration -> Development -> UI Component library. |
| 28 | + |
| 29 | +If you cannot see "UI Component library" then you will need to build it first - see below. |
| 30 | + |
| 31 | +You can also browse the Component Library online http://componentlibrary.moodle.com/admin/tool/componentlibrary/docspage.php/library/getting-started/ |
| 32 | + |
| 33 | +### Building the Component Library |
| 34 | + |
| 35 | +The Component Library is written using the same Hugo tooling that the Twitter Bootstrap framework uses. It also includes the Bootstrap libraries for the version of Bootstrap used in Moodle. |
| 36 | + |
| 37 | +The library is built from your console, and you will need to install the same NodeJS dependencies that we use for many of our other development features. |
| 38 | + |
| 39 | +See our [Grunt](https://docs.moodle.org/dev/Grunt) documentation for information on how to install these dependencies. |
| 40 | + |
| 41 | +Once you have installed the NodeJS dependencies you can then use the [grunt](http://gruntjs.com/) tooling to build the library.: |
| 42 | + |
| 43 | +```console title="Building the component library" |
| 44 | +grunt componentlibrary |
| 45 | +``` |
| 46 | + |
| 47 | +Simples! What could be easier!? |
| 48 | + |
| 49 | +### What should be documented |
| 50 | + |
| 51 | +The main aim of this library is to improve consistency of the user interface to provide a better user (and developer) experience by re-using components across Moodle. |
| 52 | + |
| 53 | +Whenever a new Moodle feature is created or updated, the building blocks for the UI of the feature should be documented in this library. |
| 54 | + |
| 55 | +The initial aim is to document any new UI feature which: |
| 56 | + |
| 57 | +- is made available in the `core` component, or any core subsystem |
| 58 | +- is made available for re-use in a plugin which offers sub-plugins |
| 59 | + |
| 60 | +The documentation of other features will also be welcomed. |
0 commit comments