0.0.8 • Published 6 years ago

@inthepocket/itp-rcc-button v0.0.8

Weekly downloads
6
License
MIT
Repository
-
Last release
6 years ago

ITP Basic React Button 🎁

Why is this a separate package? I can just define <button> inside my project?

  • We need a standard implementation to build upon and to share across projects
  • Built-in types
  • Built-in tests (todo)
  • Built-in loading styling
  • Built-in fallback on href prop to <a> element
  • Built-in spacing between icons, text and other children of button
  • Built-in A11Y (WAI-ARIA roles and attributes)
  • Built-in ButtonGroup

API

Inspired by ant-design button with stripped styling, shares the same API.

Custom API

PropertyDescriptionTypeDefault
blockblock stateBooleanfalse
colorcan be set to primary secondary tertiary or omittedstring-
ghostghost stateBooleanfalse
htmlType'submit', 'button' or 'reset'string'button'
loadingloading stateBooleanfalse
onClickonClick handlerFunction() => {}
prefixClsprefix css class namestring''
shape'circle' or 'circle-outline'stringnull
size'default', 'small' or 'large'stringnull
stylesimported css module (if passed, prefixed classNames will be disabled), see styles propertyobjectnull
type'default', 'primary', 'ghost', 'dashed' or 'danger'string'default'

Styles property

PropertyDescriptionTypeDefaultRequired
backgroundGhoststring-No
blockstring-No
buttonstring-Yes
colorPrimarystring-No
colorSecondarystring-No
colorTertiarystring-No
loadingstring-No
shapeCirclestring-No
shapeCircleOutlinestring-No
sizeLargestring-No
sizeSmallstring-No
typeDangerstring-No
typeDashedstring-No
typeGhoststring-No
typePrimarystring-No

The css module should look like this:

.backgroundGhost { ... }
.block { ... }
.backgroundGhost { ... }
.block { ... }
.button: { ... },
.colorPrimary { ... }
.colorSecondary { ... }
.colorTertiary { ... }
.loading { ... }
.shapeCircle { ... }
.shapeCircleOutline { ... }
.sizeLarge { ... }
.sizeSmall { ... }
.typeDanger { ... }
.typeDashed { ... }
.typeGhost { ... }
.typePrimary { ... }