Temple.Component.defcomp

You're seeing just the macro defcomp, go back to Temple.Component module for more information.
Link to this macro

defcomp(module, block)

View Source (macro)

Defines a component module.

This macro makes it easy to define components without creating a separate file. It literally inlines a component module.

Since it defines a module inside of the current module, local function calls from the outer module won't be available. For convenience, the outer module is aliased for you, so you can call remote functions with a shorter module name.

Usage

def MyAppWeb.SomeView do
  use MyAppWeb.SomeView, :view
  import Temple.Component, only: [defcomp: 2]

  # define a function in outer module
  def foobar(), do: "foobar"

  # define a component
  defcomp Button do
    button id: SomeView.foobar(), # `MyAppWeb.SomeView` is aliased for you.
           class: "text-sm px-3 py-2 rounded #{assigns[:extra_classes]}",
           type: "submit" do
      slot :default
    end
  end
end

# use the component in a SomeView template. Or else, you must alias `MyAppWeb.SomeView.Button`
c Button, extra_classes: "border-2 border-red-500" do
  "Submit!"
end