Button
The button has the reputation of the primitive GUI component from which the learning of UI/UX frameworks usually beings. However in spite of unremarkable appearance of rectangle with label, this component is very deceptive with its apparent simplicity.
The appearance of button could have 3 HTML elements: button, input and a, herewith, each one have own features. However, only button and a could have the child content, but only button and input could have disabled attribute.
What about the styles? Well, the changing of border color or background color is very simple, but as the requirements gets closer to the today market's leve, the quantity of variables in equation increases sharply. Firs, being the control element, the button has the plenty of states such as hover, focus, active, disabled. All of these states must be visually distinguishable, herewith for each theme if any (it even does not matter the theme in YDF understanding or no). Some of these states are mutually exclusive, some of these states could occur simultaneously thus the styles must be applied in certain order avoiding the conflicts.
And, what it the label does not fit in the button? What if required to add the SVG icon to button? All icons hase different sizes, and internal indents in SVG canvas is also different! The method of color changing in icon depends on it SVG code, while icon must change its color depends on specific states of button! What is the button must have the square shape when it have only icon without label? (Although we are basically not recommend the icons without labels because their meaning could be not understood by the users with poor experience, the attempts to assure the customers avoid the using of icon-only button is not always successful). As far as respect these "what it"s, the output CSS-code becomes more complicated and large in volume.
From our side, we made all possible to encapsulate this complexity to clear API. Nevertheless, creating the valid HTML with respecting of accessibility and, if required, the SEO, it is required to understand which HTML code will be generated.
Overview
- Pug mixin
Button--YDF- Live templates of Pug Mixin (IntelliJ IDEA IDEs family official plugin)
- Autocomplete-like
Button--YDF- Abbreviation
btn-ydf- Loading Placeholder
Button--YDF-LoadingPlaceholder
- Stylus mixin for styles generating
generateButtonYDF_GUI_ComponentStyles- Pre-made themes
Button__YDF.Themes.regular- Regular (Default)
- Pre-made geometric variations
Button__YDF.GeometricVariations.regular- Regular (Default)
Button__YDF.GeometricVariations.small- Small
Button__YDF.GeometricVariations.linkLike- Link Like
- Geometric modifiers
Button__YDF.GeometricModifiers.pillShape- Maximal Roundings of the Corners
Button__YDF.GeometricModifiers.squareShape- Square Shape
Button__YDF.GeometricModifiers.squareShapeUnlessOverflowed- Square Shape Unless Overflowed
Button__YDF.GeometricModifiers.singleLine- Always Single Line with Text Truncating on Overflow
Button__YDF.GeometricModifiers.noLeftBorderAndRoundings- No Left Border and Roundings
Button__YDF.GeometricModifiers.noRightBorderAndRoundings- No Right Border and Roundings
Button__YDF.GeometricModifiers.noTopBorderAndRoundings- No Top Border and Roundings
Button__YDF.GeometricModifiers.noBottomBorderAndRoundings- No Bottom Border and Roundings
Button__YDF.GeometricModifiers.noRoundings- No Roundings
Button__YDF.GeometricModifiers.horizontallyShrinkable- Horizontally Shrinkable
- Pre-made decorative variations
Button__YDF.DecorativeVariations.regular- Regular (Default)
Button__YDF.DecorativeVariations.accented- Accessed
Button__YDF.DecorativeVariations.danger- Danger Action
Button__YDF.DecorativeVariations.linkLike- Link Like
- Decorative Modifiers
Button__YDF.DecorativeModifiers.bordersDisguising- No Borders Effect without Changing of Dimensions
Button__YDF.DecorativeModifiers.noBackground- No Background
Button__YDF.DecorativeModifiers.noBackgroundInDefaultState- No Background in Default State
- Loading placeholder
- Unavailable
Usage
Markup
Including to Project
The markup of this GUI Component is been provided by the Pug mixin with name Button--YDF. The including method is standard, by other words, the including of the Pug file Components.pug to your Pug file, herewith it is also required to include preliminary the Functionality.pug file (the last one already included to pages templates so if it include them one more time, the error will occur).
include ../../node_modules/@yamato-daiwa/frontend/Functionality.pug
include ../../node_modules/@yamato-daiwa/frontend/Components.pugIn your case the relative path to node_modules directory could differ depending on how deep below the project root directory your Pug file including above code been stored.
Recall that just including of these files will not give any output HTML code because to get the output HTML code of Button it is required to call Button--YDF Pug mixin. Besides this, if currently the styles has not been provided yet, although the HTML code will be generated, the displaying will be incorrect. If you don't know how to provide styles yet, don't worry — it will be explained below.
Pug Mixin Button--YDF
- Generic technical name
- properties
- Localized name
- Properties
- Type
- Properties
- HTML_Type
- Type
- string
- Undefined Value Substitution
- Button__YDF.HTML_Types.regular
- Is Null Forbidden
- Yes
- Allowed Alternatives
- Button__YDF.HTML_Types.regular
- Button__YDF.HTML_Types.submit
- Button__YDF.HTML_Types.inputButton
- Button__YDF.HTML_Types.inputSubmit
- Button__YDF.HTML_Types.inputReset
- label
- Type
- Polymorphic
- Undefined Forbidden if
- `HTML_Type` property specified with `Button__YDF.HTML_Types.inputButton`, `Button__YDF.HTML_Types.inputSubmit` or `Button__YDF.HTML_Types.inputReset`
- Is Null Forbidden
- Yes
- Variants
- Type
- string
- Minimal Characters
- 1
- Type
- number
- Numbers Set
- any real number
- accessibilityGuidance
- Type
- string
- Is Undefined Forbidden
- No
- Is Null Forbidden
- Yes
- Minimal Characters
- 1
- URI
- Type
- string
- Is Undefined Forbidden
- No
- Is Null Forbidden
- Yes
- Minimal Characters
- 1
- mustOpenLinkInNewTab
- Type
- boolean
- Undefined Value Substitution
- false
- Is Null Forbidden
- Yes
- mustRequestNotFollowLinkForCrawlingToSearchEngine
- Type
- boolean
- Undefined Value Substitution
- false
- Is Null Forbidden
- Yes
- disabled
- Type
- boolean
- Undefined Value Substitution
- false
- Is Null Forbidden
- Yes
- toggled
- Type
- boolean
- Undefined Value Substitution
- false
- Is Null Forbidden
- Yes
- theme
- Type
- string
- Undefined Value Substitution
- Button__YDF.Themes.regular
- Is Null Forbidden
- Yes
- Allowed Alternatives
- Button__YDF.Themes.regular
- (Any of ones defined via `Button__YDF.defineThemes(themesNames)`)
- areThemesCSS_ClassesCommon
- Type
- boolean
- Undefined Value Substitution
- Button__YDF.areThemesCSS_ClassesCommon
- Is Null Forbidden
- Yes
- geometricVariation
- Type
- string
- Undefined Value Substitution
- Button__YDF.GeometricVariations.regular
- Is Null Forbidden
- Yes
- Allowed Alternatives
- Button__YDF.GeometricVariations.regular
- Button__YDF.GeometricVariations.small
- Button__YDF.GeometricVariations.linkLike
- (Any of ones defined via `Button__YDF.defineGeometricVariations(geometricVariationsNames)`)
- geometricModifiers
- Type
- Indexed array
- Undefined Value Substitution
- []
- Is Null Forbidden
- Yes
- Are Undefined Elements Forbidden
- Yes
- Are Null Elements Forbidden
- Yes
- Array Elements
- Type
- string
- Allowed Alternatives
- Button__YDF.GeometricModifiers.pillShape
- Button__YDF.GeometricModifiers.squareShape
- Button__YDF.GeometricModifiers.squareShapeUnlessOverflowed
- Button__YDF.GeometricModifiers.singleLine
- Button__YDF.GeometricModifiers.noLeftBorderAndRoundings
- Button__YDF.GeometricModifiers.noRightBorderAndRoundings
- Button__YDF.GeometricModifiers.noTopBorderAndRoundings
- Button__YDF.GeometricModifiers.noBottomBorderAndRoundings
- Button__YDF.GeometricModifiers.noRoundings
- Button__YDF.GeometricModifiers.horizontallyShrinkable
- decorativeVariation
- Type
- string
- Undefined Value Substitution
- Button__YDF.DecorativeVariations.regular
- Is Null Forbidden
- Yes
- Allowed Alternatives
- Button__YDF.DecorativeVariations.regular
- Button__YDF.DecorativeVariations.accented
- Button__YDF.DecorativeVariations.danger
- Button__YDF.DecorativeVariations.linkLike
- (Any of ones defined via `Button__YDF.defineDecorativeVariations(decorativeVariationsNames)`)
- decorativeModifiers
- Type
- Indexed array
- Undefined Value Substitution
- []
- Is Null Forbidden
- Yes
- Are Undefined Elements Forbidden
- Yes
- Are Null Elements Forbidden
- Yes
- Array Elements
- Type
- string
- Allowed Alternatives
- Button__YDF.DecorativeModifiers.bordersDisguising
- Button__YDF.DecorativeModifiers.noBackground
- Button__YDF.DecorativeModifiers.noBackgroundInDefaultState