PHPackages                             rsc/components - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. rsc/components

ActiveMagento2-module[Templating &amp; Views](/categories/templating)

rsc/components
==============

A collection reusable, discreet components for building various types of commonly-used markup.

1.1.0(8y ago)06PHPPHP ~5.6.5|7.0.2|7.0.4|~7.0.6

Since Jul 11Pushed 8y agoCompare

[ Source](https://github.com/baublet/mage2-components)[ Packagist](https://packagist.org/packages/rsc/components)[ RSS](/packages/rsc-components/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

RSC Components
==============

[](#rsc-components)

A slim, discreet, reusable component library and framework to ease interoperability between various parts of a Magento2 installation.

Components
----------

[](#components)

For the purposes of this extension, a component is any portion of HTML markup that will be rendered onto the page using an assortment of PHP variables, and which *may* in the future, be reused. If you think there is even a chance that your markup will be reused, make it a component.

Structure
---------

[](#structure)

Components all inherit the Base component, and are grouped into various categories:

```
Model/Basic         Basic components, such as buttons or links
Model/Groups        Components that use other components in their rendering, such as FormGroups
Model/Input         Components related to user input

```

Components' templates reside in the extension's `view/frontend/Components` directory. When you create new components, please place your new components in its corresponding directory.

Creating a New Component
------------------------

[](#creating-a-new-component)

First thing's first: we want this component to be tested. If it's not tested, it's not working. So figure out where in the directory (`Components/Model`) your component belongs (create a new one if you want), and create the `MyComponent.test.php` file.

### Testing

[](#testing)

We have eschewed a bulky testing framework for testing these components, since the goal is to be lightweight and ensure basic functionality tests at the PHP level. For ensuring more robust UI testing and hunting down regressions, the component library is intended to be displayed on a styleguide or pattern library.

When you create your own tests, test the most basic unit available that you are fairly sure will always be the responsibility of this component.

For example, if you make a link component, you may not be sure that the link will have a `class`, `title`, or `id` attribute. But because it is a link, you can be pretty certain that it will have a `href` attribute, and contain some content text. So let's test those.

```
