From 6e25dbcadf9c96513356bdecba1390f9c9cd7d5c Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Sun, 2 Aug 2020 23:31:43 +0530 Subject: [PATCH] Added Descriptions for more components Added- notifications popup switch select strip select tabs --- Standard UI Components/README.md | 362 +++++++++++++++++++++++++++++-- 1 file changed, 338 insertions(+), 24 deletions(-) diff --git a/Standard UI Components/README.md b/Standard UI Components/README.md index b54ff5a..776cbfe 100644 --- a/Standard UI Components/README.md +++ b/Standard UI Components/README.md @@ -141,6 +141,8 @@ This will align elements such that element will align from left edge to the caro Once focused elements inside carousel can be scrolled using ***Arrow Keys***. +When `sm-carousel` encounters an environment where only touch is supported it switches to touch based navigation like swipe scrolling and tapping. But when pointer like mouse is suppoted it switches to arrow button based navigation. + #### Is it ***Responsive***? Yes, it will adjust according to screen size and input interrfaces like mouse, touch or keyboard. @@ -164,7 +166,7 @@ This has two custom attributes `checked` and `disabled`. ``` 2. disabled ```html - + ``` @@ -194,15 +196,24 @@ This component supports keyboard interactivity like ***Enter*** or ***Spacebar** ``` html ``` +```js +let myCheckbox = document.getElementById('my_checkbox'); +``` ##### To set checked ```js -let checkbox = document.getElementById('my_checkbox'); checkbox.checked="true" //or -checkbox.setAttribute('checked', 'true') +myCheckbox.setAttribute('checked', 'true') ``` Replace `"true"` with `"false"` to un-tick checkbox +##### To set disabled +```js +myCheckbox.disabled="true" +//or +myCheckbox.setAttribute('disabled', 'true') +``` + ### Input [See Demo](https://sairaj-mote.github.io/components/) @@ -213,28 +224,15 @@ Replace `"true"` with `"false"` to un-tick checkbox This is a replacement for ``. #### Custom Attributes -This has two custom attributes `checked` and `disabled`. -1. placeholder -```html - - -``` -2. value -```html - - -``` -3. helper-text -```html - - -``` -4. animate -```html - - -``` +Attribute | Description +--- | --- +placeholder (string) | Displayes placeholder text inside +type (string) | Specify type of input to enable validation. Valid values - `email`, `number`, `text`, `password`. +value (string) | Sets input value from markup +helper-text (string) | Sets helper text that will be shown when validation fails for input. +animate | Add to enable animated placeholder + By default placeholder will disappear when input field has some value. #### Supported Events @@ -273,3 +271,319 @@ console.log(myInput.value) ```js console.log(myInput.isValid) ``` + +### Notifications +[See Demo](https://sairaj-mote.github.io/components/) + +```html + +``` + +`` allows showing push notifications easily and supports multiple notifications at same time. + +#### Setup + +Add `` to top of your markup just below starting `` tag. + +``` html + + +``` +```js +let myNotifications = document.getElementById('my_notifications'); +``` + +#### Manipulation via Javascript +This component has a method called `push()`. Which can be used to display notifications to user. It accepts three parameters `notificationHeading`, `notificationBody` and `options`. + +Parameter | Description +--- | --- +notificationHeading (string) | Heading displayed at the top of a notification. This should be short and describe main purpose of that notification. +notificationBody (string) | This consists of most of the descriptive part of a notification. This will elaborate more on notification heading. +options (object) | Used to configure more options about individual notification. This is optional. + +Options | Description +--- | --- +`type` (string) | This property can have two valid inputs `success` and `error`. Specifiying this will add an icon before heading to indicate success or failure of an operation. +`pinned` (boolean) | IF set `true`notification won't dismiss automatically after set time interval. User has to intentionally dismiss it. + +##### To push a notification +```js +myNotifications.push(notificationHeading, notificationBody) +``` +##### To specify notification type +Set `"success"` or `"error"` to display intended notification style. +```js +let options = { + type: 'error' +} +myNotifications.push(notificationHeading, notificationBody, options) +``` +##### To push a pinned notification +```js +let options = { + pinned: true +} +myNotifications.push(notificationHeading, notificationBody, options) +``` + +#### Is it ***Responsive***? + +Yes, it will adjust according to screen size and input interrfaces like mouse, touch or keyboard. This supports touch gestures like swipe to dismiss. + + +### Popup +[See Demo](https://sairaj-mote.github.io/components/) + +```html + +// + Elements you want to add to popup. + // + +``` + +`` allows creating modal that can replace HTML5 `` element. + +#### Custom Attributes +This has one custom attribute `heading` that is used to set header of popup. + +1. heading +```html + + +``` + +#### Setup + +``` html + + +``` +```js +let myPopup = document.getElementById('my_popup'); +``` + +#### Manipulation via Javascript +This component has two methods, `show()` and `hide()`. + +Method | Description +--- | --- +`show()` | Shows popup when called on respective popup. +`hide()` | Hides popup when called on respective popup. + +##### To show popup +Scrolling in the background will be disabled when popup is open. It will be restored when popup is closed. +```js +myPopup.show() +``` +##### To hide popup +```js +myPopup.hide() +``` + +#### Is it ***Responsive***? + +Yes, it will adjust according to screen size and input interrfaces like mouse, touch or keyboard. This supports touch gestures like drag to close. + +### Switch +[See Demo](https://sairaj-mote.github.io/components/) + +```html + +``` + +#### Custom Attributes +This has two custom attributes `checked` and `disabled`. + +1. Checked +```html + + +``` +2. disabled +```html + + +``` + +#### Disabled State + +This component can disabled adding `disabled="true` attribute. + +You can also have option to use both of these attributes at the same time. +```html + + +``` + +#### Supported Events + +This supports `change` event. Fires when component state changes. + +#### Is it ***Responsive***? + +No, As by default this is an inline element. + +#### Accessibility + +This component supports keyboard interactivity like ***Enter*** or ***Spacebar*** to click on it. + +#### Manipulation via Javascript +``` html + +``` +```js +let mySwitch = document.getElementById('mySwitch'); +``` +##### To set checked +```js +mySwitch.checked="true" +//or +mySwitch.setAttribute('checked', 'true') +``` +Replace `"true"` with `"false"` to turn switch off. + +##### To set disabled +```js +mySwitch.disabled="true" +//or +mySwitch.setAttribute('disabled', 'true') +``` +Replace `"true"` with `"false"` to enable switch. + +### Select +[See Demo](https://sairaj-mote.github.io/components/) + +```html + +``` + +`` is very similar to standard HTML `` in terms of general markup and options. If you want to add an option then you have to use `` instead of `