miso
Copyright(C) 2016-2026 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Native.X.Element.Svg.Property

Contents

Description

Since: 1.13.0.0

Synopsis

Property

content_ :: context -> props -> model -> View context props model action -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/svg.html#content

Inline SVG XML content using miso View Syntax.

content_ context props model (svg_ [] [])

N.B. Must use Miso.Svg and svg_ combinator.

The content is serialised to a string when the attribute is built, so there is no running component to take context, props or model from: the caller supplies all three, and vcontext / vprops / vmodel inside the content resolve against those values. To draw from the enclosing component, obtain them with withContext / withProps / withModel above the element and pass them down:

withContext $ \context -> withProps $ \props -> withModel $ \model ->
  svg_
    [ content_ context props model $ Svg.svg_
        [ textProp "xmlns" "http://www.w3.org/2000/svg" ]
        [ Svg.circle_ [ Svg.fill_ color ] [] ]
    ]
    []

or use svgWith_, which does that lifting and lets the content itself use vcontext / vprops / vmodel.

Since: 1.14.0.0

contentRaw_ :: MisoString -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/svg.html#content

Inline SVG XML content.

content_ "<svg>...</svg>"

src_ :: MisoString -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/svg.html#src

SVG resource URL.

src_ "https://url.com/image.svg"