Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
TwitterShare.svelte
<script>
import TwitterShare from './TwitterShare.svelte';
</script>

<TwitterShare
text="A Twitter share button with progressive enhancement"
url="https://svelte.dev/repl/98aa20d4cb3d40dabfef7d8dae183b85"
via="sveltejs"
/>
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import TwitterShare from './TwitterShare.svelte';

export default function App($$anchor) {
TwitterShare($$anchor, {
text: 'A Twitter share button with progressive enhancement',
url: 'https://svelte.dev/repl/98aa20d4cb3d40dabfef7d8dae183b85',
via: 'sveltejs'
});
}
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • Root {
    • css: null
    • js: []
    • start: 71
    • end: 227
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (2)
        • Text {...}
          • type: "Text"
          • start: 69
          • end: 71
          • raw: "\n\n"
          • data: "\n\n"
          }
        • Component {...}
          • type: "Component"
          • start: 71
          • end: 227
          • name: "TwitterShare"
          • attributes: [...] (3)
            • Attribute {...}
              • type: "Attribute"
              • start: 86
              • end: 144
              • name: "text"
              • value: [...] (1)
                • Text {...}
                  • start: 92
                  • end: 143
                  • type: "Text"
                  • raw: "A Twitter share button with progressive enhancement"
                  • data: "A Twitter share button with progressive enhancement"
                  }
                ]
              }
            • Attribute {...}
              • type: "Attribute"
              • start: 146
              • end: 208
              • name: "url"
              • value: [...] (1)
                • Text {...}
                  • start: 151
                  • end: 207
                  • type: "Text"
                  • raw: "https://svelte.dev/repl/98aa20d4cb3d40dabfef7d8dae183b85"
                  • data: "https://svelte.dev/repl/98aa20d4cb3d40dabfef7d8dae183b85"
                  }
                ]
              }
            • Attribute {...}
              • type: "Attribute"
              • start: 210
              • end: 224
              • name: "via"
              • value: [...] (1)
                • Text {...}
                  • start: 215
                  • end: 223
                  • type: "Text"
                  • raw: "sveltejs"
                  • data: "sveltejs"
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: []
            }
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 69
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 60
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 3
            • column: 0
            }
          }
        • body: [...] (1)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 59
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 50
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 29
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 20
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 29
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 20
                      }
                    }
                  • name: "TwitterShare"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 35
              • end: 58
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 26
                  }
                • end: {...}
                  • line: 2
                  • column: 49
                  }
                }
              • value: "./TwitterShare.svelte"
              • raw: "'./TwitterShare.svelte'"
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
TwitterShare • Playground • Svelte