Surface UI

A server-side rendering component library for Phoenix

Surface UI

A component library for Phoenix

  • Home
  • Getting started
  • Documentation
    • Components Basics
    • Properties
    • Data
    • Events
    • Slots
    • State Management
    • Contexts
    • Testing
    • JS Interoperability
  • Built-in Components
    • Navigation

    • Link
    • LivePatch
    • LiveRedirect
    • Form

    • Form
    • Field
    • FieldContext
    • Label
    • Input Controls
    • TextArea
    • Select
    • ErrorTag
    • Other

    • Markdown
    • Raw
  • UI Components (WIP)
    • Button
    • Table
    • Tabs
  • Home
  • Getting started
  • Documentation
    • Components Basics
    • Properties
    • Data
    • Events
    • Slots
    • State Management
    • Contexts
    • Testing
    • JS Interoperability
  • Built-in Components
    • Navigation

    • Link
    • LivePatch
    • LiveRedirect
    • Form

    • Form
    • Field
    • FieldContext
    • Label
    • Input Controls
    • TextArea
    • Select
    • ErrorTag
    • Other

    • Markdown
    • Raw
  • UI Components (WIP)
    • Button
    • Table
    • Tabs
  • Home
  • Built-in Components
  • Link

Link

Generates a link to the given URL


Provides similar capabilities to Phoenix's built-in link/2 function.

Options label and class can be set directly and will override anything in opts. All other options are forwarded to the underlying <a> tag.


Go to source

<Link
  label="Go to source"
  to="https://github.com/surface-ui/surface/blob/master/lib/surface/components/link.ex"
  opts={{ data: [confirm: "Are you sure?"] }}
/>

# Public API

  • Properties
  • Slots
  • Events
Name Description Type Values Default
to Required. The page to link to.

:any — —
method The method to use with the link.

:atom — :get
class Class or classes to apply to the link.

:css_class — —
label The label for the generated <a> element, if no content (default slot) is provided.

:string — —
opts Additional attributes to add onto the generated element.

:keyword — []
Name Description
default The content of the generated <a> element. If no content is provided, the value of property label is used instead.

Name Description
click

Triggered on click.

Name Description

Surface v0.3.2 - github.com/surface-ui/surface.