MCPcopy Create free account
hub / github.com/formkit/formkit / stepIcon

Function stepIcon

packages/addons/src/plugins/multiStep/sections/stepIcon.ts:8–41  ·  view source on GitHub ↗
(
  sectionKey: string,
  el?: string
)

Source from the content-addressed store, hash-verified

6 * @public
7 */
8export const stepIcon = (
9 sectionKey: string,
10 el?: string
11): FormKitSchemaExtendableSection => {
12 return createSection(`${sectionKey}Icon`, () => {
13 const rawIconProp = `_raw${sectionKey
14 .charAt(0)
15 .toUpperCase()}${sectionKey.slice(1)}Icon`
16 return {
17 if: `$step.${sectionKey}Icon && $step.${rawIconProp}`,
18 then: {
19 $el: `${el ? el : 'span'}`,
20 attrs: {
21 class: `$classes.${sectionKey}Icon + " formkit-icon"`,
22 innerHTML: `$step.${rawIconProp}`,
23 role: 'presentation',
24 onClick: `$handlers.iconClick(${sectionKey})`,
25 },
26 },
27 else: {
28 if: `$${sectionKey}Icon && $${rawIconProp}`,
29 then: {
30 $el: `${el ? el : 'span'}`,
31 attrs: {
32 class: `$classes.${sectionKey}Icon + " formkit-icon"`,
33 innerHTML: `$${rawIconProp}`,
34 role: 'presentation',
35 onClick: `$handlers.iconClick(${sectionKey})`,
36 },
37 },
38 },
39 }
40 })()
41}

Callers 1

schema.tsFile · 0.90

Calls 1

createSectionFunction · 0.90

Tested by

no test coverage detected