Using the Surface example for the last section in the slot docs called “Binding slot arguments to generators”, I’m trying to imagine how one would add a custom slot for headers for each column in the indexed slots. Could the Column, which already is a slot argument, somehow implement slot additional slots?
defmodule Column do
use Surface.Component, slot: "cols"
@doc "The title of the column"
prop title, :string
@doc "custom column header"
slot th
end
def render(assigns) do
~F"""
<div>
<Grid items={album <- @albums}>
<Column>
{!-- some custom header definition --}
<:th>
<Checkbox />
</:th>
<Checkbox />
</Column>
<Column title="Artist">
<a href="#">{album.artist}</a>
</Column>
</Grid>
</div>
"""
end
Could something like this be possible? Is there a reasonable workaround to only define certain column headers that require customization, such as a checkbox on each row and the column header. Perhaps you can define a header slot to only render at a certain column index?