Download the PHP package lmc/spirit-web-twig-bundle without Composer
On this page you can find all versions of the php package lmc/spirit-web-twig-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lmc/spirit-web-twig-bundle
More information about lmc/spirit-web-twig-bundle
Files in lmc/spirit-web-twig-bundle
Package spirit-web-twig-bundle
Short Description This is Symfony bundle with twig implementation of the Spirit Design System components and extends the twig implementation with an HTML-like syntax.
License MIT
Informations about the package spirit-web-twig-bundle
Spirit Web Twig Bundle
This is a Symfony bundle with Twig implementation of Spirit Design System components, extended with JSX-like syntax.
Requirements
- PHP >= 8.1
- Symfony 4.4+ || 5.4+ || ^6.1
- Twig >=2.12.5 || 3+
Changelog
See CHANGELOG
How to install
Step 1
Download using composer
Install package
Step 2
Add SpiritWebTwigBundle
into bundles (under all
bundles). If you use Symfony flex, it will be configured automatically.
bundles.php
Step 3 (optional)
If you want to change the default settings, create a config
config/packages/spirit_web_twig.yml
Usage
For detailed usage see TwigX bundle
Unescaped Props
All props that internally uses the raw filter are prefixed with UNSAFE_
.
This is considered a way how you can pass down HTML strings.
Spirit Components
For available components see the components directory.
if you want to extend these components, an example guide is here. if you want to contribute, read the guide here.
Additional Attributes
All components accept additional attributes that are passed down to the root element of the component. This is useful for adding custom event handlers, accessibility attributes, or other attributes that are not supported by the component API.
ℹ️ If you need to pass down event handlers to the native form elements in our form components,
you can use the inputProps
prop.
Supported attributes are:
on*
(eg.onclick
)data-*
aria-*
id
If the component sets a value for any of these attributes, the value passed in will be overwritten.
Styling
Spirit components are designed to be consistent across all Alma Career applications. They include built-in styling that has been considered carefully, and extensively tested. In general, customizing Spirit design is discouraged, but most components do offer control over layout and other aspects. In addition, you can use Spirit defined design tokens to ensure your application conforms to your design requirements, and is adaptive across platform scales and color schemes.
Style Props
All Spirit components accept a set of props that can be used to control their outer spacing. The props are:
margin
marginTop
marginRight
marginBottom
marginLeft
marginX
marginY
These props accept a spacing token (eg. space-100
), auto
or an object with breakpoint keys and spacing token
values or auto
. We use these props to set global CSS utility classes on the root element of the component.
Examples:
If you need more control over the styling of a component, you can use escape hatches.
Escape Hatches
While we encourage teams to utilize Spirit design as it is, we do realize that sometimes product specific customizations may be needed. In these cases, we encourage you or your designers to talk to us. We may be able to suggest an alternative implementation strategy, or perhaps your design can help propose future Spirit additions.
While the traditional class and style props are not supported in Spirit Web Twig components, there are two escape hatches that you can use at your own risk. These are UNSAFE_className and UNSAFE_style. Use of these props should be considered a last resort. They can be used to work around bugs or limitations in Spirit Web Twig, but should not be used in the long term.
The reasoning behind this is that future updates to Spirit design may cause unintended breaking changes in products. If the internal DOM structure or CSS properties of a Spirit Web Twig component change, this may lead to conflicts with CSS overrides in products. For this reason, className and style are unsafe, and if you use them know that you are doing so at your own risk.
Please consult additional styling with web package documentation.
Deprecations
This package uses the deprecation warnings for props, functions and components that will be removed or replaced in the next major release. Check your Symfony console or log to see if you are using any of the deprecated functionality.
All versions of spirit-web-twig-bundle with dependencies
ext-simplexml Version *
lmc/twigx-bundle Version ^3.3
symfony/config Version ^4.4 || ^5.4 || ^6.1
symfony/dependency-injection Version ^4.4 || ^5.4 || ^6.1
symfony/http-foundation Version ^4.4 || ^5.4 || ^6.1
symfony/http-kernel Version ^4.4 || ^5.4 || ^6.1
symfony/polyfill-php80 Version ^1.23
twig/twig Version ^2.12.5 || ^3.0.0