Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primer::Beta::Button Add option to render a delete button #2712

Closed
AchoArnold opened this issue Mar 24, 2024 · 1 comment
Closed

Primer::Beta::Button Add option to render a delete button #2712

AchoArnold opened this issue Mar 24, 2024 · 1 comment
Labels

Comments

@AchoArnold
Copy link

Add an option to render a form in rails so we can create a delete button in CRUD apps e.g

<%= render(Primer::Beta::Button.new(
              scheme: :danger,
              size: :small,
              ml: 2,
              form_arguments: { method: :delete},
              href: delete_endpoint_path(endpoint.id),
              tag: :a,
              )) do |button| %>
              <% button.with_leading_visual_icon(icon: :trash) %>
              Delete
            <% end %>
@camertron
Copy link
Contributor

Hey @AchoArnold, thanks for bringing this up 😄 Using Button to submit a DELETE request should already be possible via Rails' form_with:

<%= form_with(url: "/foo", method: :delete) do %>
  <%= render(Primer::Beta::Button.new(scheme: :danger, type: :submit)) do |button| %>
    <% button.with_leading_visual_icon(icon: :trash) %>
    Delete
  <% end %>
<% end %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants