1.0.117 • Published 2 months ago

@web-atoms/data-styles v1.0.117

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

Web Atoms Data Styles

Data styles utilizes data attributes to specify some easy styles. data-styles.d.ts provides intellisense to add corresponding data attributes in JSX.

Installation

  1. You can directly reference data-styles.css.
  2. Or you can import SystemJS module data-styles.js.

Usage

Multiple attributes on single node.

    <div
        data-font-weight="bold"
        data-color="red"/>

Change attribute based on condition

    <div
        data-font-weight={ isSomethingTrue ? "bold" : "normal" }
        data-color={ isValid ? "default" : "red" }
        />

Why?

  1. Data Styles are composable, you can combine multiple attributes on single node.

Why not style attribute?

  1. Style attribute is heavy, there is additional CSSStyleDeclaration created and associated with each element along with actual style that to be displayed.
  2. Style attribute requires parsing every time the style has been set, where else when set in data attribute, all styles are already parsed and they are associated with element quickly.
  3. Style attribute is not customizable, for example, we have a styled call data-layout="accent-button". When you are creating reusable components, you can specify initial styles using data attributes. And end user can customize styles based on desired design needs. Inline style does not allow other customizations such as media queries, pseudo elements, hover, active etc.

Layouts

We have created some basic layouts that are reusable and customizable.

  1. row - a single flex row with gap and padding of 5px (customizable through variables).
  2. flex-wrap - flex wrap with gap and padding of 5px.
  3. command-row - same as row but with some additional background and styling for container buttons.
  4. button - button with flex to contain and position icons correctly, there are various buttons such as accent-button, go-button (green), reject-button (dark red), stop-button (red), accept-button (blue).
  5. link - a simple link with text decoration set to none and on hover text decoration is set to underline. Colors are customizable.
  6. warning - a warning flex box with default border, radius and warning background color.
1.0.117

2 months ago

1.0.116

2 months ago

1.0.110

3 months ago

1.0.112

3 months ago

1.0.111

3 months ago

1.0.114

3 months ago

1.0.113

3 months ago

1.0.115

3 months ago

1.0.109

3 months ago

1.0.107

4 months ago

1.0.108

4 months ago

1.0.106

4 months ago

1.0.101

10 months ago

1.0.100

10 months ago

1.0.103

8 months ago

1.0.102

8 months ago

1.0.105

8 months ago

1.0.104

8 months ago

1.0.99

10 months ago

1.0.98

11 months ago

1.0.97

11 months ago

1.0.96

11 months ago

1.0.95

11 months ago

1.0.94

11 months ago

1.0.93

11 months ago

1.0.92

11 months ago

1.0.91

11 months ago

1.0.90

11 months ago

1.0.89

11 months ago

1.0.88

11 months ago

1.0.87

11 months ago

1.0.86

11 months ago

1.0.85

11 months ago

1.0.84

11 months ago

1.0.83

11 months ago

1.0.82

11 months ago

1.0.81

11 months ago

1.0.80

11 months ago

1.0.79

11 months ago

1.0.78

11 months ago

1.0.77

11 months ago

1.0.76

11 months ago

1.0.75

11 months ago

1.0.74

11 months ago

1.0.73

11 months ago

1.0.72

11 months ago

1.0.71

11 months ago

1.0.70

11 months ago

1.0.69

11 months ago

1.0.68

11 months ago

1.0.67

11 months ago

1.0.66

11 months ago

1.0.65

11 months ago

1.0.64

11 months ago

1.0.63

11 months ago

1.0.62

11 months ago

1.0.61

11 months ago

1.0.60

11 months ago

1.0.59

11 months ago

1.0.58

11 months ago

1.0.57

11 months ago

1.0.56

11 months ago

1.0.55

11 months ago

1.0.54

11 months ago

1.0.53

11 months ago

1.0.52

11 months ago

1.0.51

11 months ago

1.0.50

11 months ago

1.0.49

11 months ago

1.0.48

11 months ago

1.0.47

11 months ago

1.0.46

11 months ago

1.0.45

11 months ago

1.0.44

11 months ago

1.0.43

11 months ago

1.0.42

11 months ago

1.0.41

11 months ago

1.0.40

11 months ago

1.0.39

11 months ago

1.0.38

11 months ago

1.0.37

12 months ago

1.0.36

12 months ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago