File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ type alias Tag msg =
26
26
, text : String
27
27
, rightText : Maybe String
28
28
, action : TagAction msg
29
+ , className : Maybe String
29
30
, size : TagSize
30
31
}
31
32
@@ -42,6 +43,7 @@ tag text_ =
42
43
, rightText = Nothing
43
44
, action = NoAction
44
45
, size = Medium
46
+ , className = Nothing
45
47
}
46
48
47
49
@@ -54,6 +56,11 @@ withIcon icon t =
54
56
{ t | icon = Just icon }
55
57
56
58
59
+ withClassName : String -> Tag msg -> Tag msg
60
+ withClassName className t =
61
+ { t | className = Just className }
62
+
63
+
57
64
withClick : Click msg -> Tag msg -> Tag msg
58
65
withClick click t =
59
66
{ t | action = TagClick click }
@@ -120,6 +127,7 @@ map toMsg t =
120
127
, leftText = t. leftText
121
128
, text = t. text
122
129
, rightText = t. rightText
130
+ , className = t. className
123
131
, action = mapAction toMsg t. action
124
132
, size = t. size
125
133
}
@@ -164,6 +172,10 @@ view t =
164
172
165
173
attrs =
166
174
[ class " tag" , sizeClass ]
175
+ ++ ( t. className
176
+ |> Maybe . map ( \ cn -> [ class cn ] )
177
+ |> Maybe . withDefault []
178
+ )
167
179
168
180
content =
169
181
MaybeE . values [ icon, Just tagText ]
You can’t perform that action at this time.
0 commit comments