popcicle

Types

pub type PopcicleConfig {
  PopcicleConfig(css: String, click_gap: Int, hover_gap: Int)
}

Constructors

  • PopcicleConfig(css: String, click_gap: Int, hover_gap: Int)
pub type PrefferedPosition {
  TopLeft
  TopCenter
  TopRight
  RightTop
  RightCenter
  RightBottom
  BottomLeft
  BottomCenter
  BottomRight
  LeftTop
  LeftCenter
  LeftBottom
  Custom(Int, Int)
}

Constructors

  • TopLeft
  • TopCenter
  • TopRight
  • RightTop
  • RightCenter
  • RightBottom
  • BottomLeft
  • BottomCenter
  • BottomRight
  • LeftTop
  • LeftCenter
  • LeftBottom
  • Custom(Int, Int)
pub type ShowType {
  Click
  Hover
}

Constructors

  • Click
  • Hover

Functions

pub fn close_on_click(when: Bool) -> Attribute(a)

Add to any child element of a popcicle and it will close the popcicle when clicked, good for dialog close buttons and such

pub fn contains(element: Element, other: Element) -> Bool
pub fn default_config() -> PopcicleConfig
pub fn initialize(
  config: PopcicleConfig,
  cb: fn() -> Element(a),
) -> Element(a)
pub fn popcicle(
  child: Element(a),
  position: PrefferedPosition,
  popcicle: Element(a),
  show_on: ShowType,
) -> Element(a)

A simple popcicle will add the element in the child parameter where the function is called. Then when that element is pressed (show_on=popcicle.Click) or hovered (show_on=popcicle.Hover), it will show the popcicle as a popover positioned by the position parameter. By default the popcicle and it’s button comes completely unstyled and you can use it that way however, it is highly recommened you create your own styled functions. If you don’t want to do that then there is a prestyled component based on shadcn/ui that you can simply copy into your project: Dropdown Menu

Search Document